tree:
git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-linux-5.4.y
head: 3cdbcdd591d4a26a51eba81bba6422754950f98d
commit: 7368a2a6ed6136e0a9e331a92505e66efeca24e2 [7325/7338] net: ti: prueth_core: add
HSR/PRP firmware specific init functions
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 7368a2a6ed6136e0a9e331a92505e66efeca24e2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/net/ethernet/ti/prueth_lre.c: In function
'prueth_lre_emac_rx_packets':
> drivers/net/ethernet/ti/prueth_lre.c:244:36: warning: variable
'queue_desc_p' set but not used [-Wunused-but-set-variable]
244 |
struct prueth_queue_desc __iomem *queue_desc_p;
| ^~~~~~~~~~~~
> drivers/net/ethernet/ti/prueth_lre.c:243:43: warning: variable
'status_o' set but not used [-Wunused-but-set-variable]
243 | u8
overflow_cnt, overflow_cnt_o, status, status_o;
| ^~~~~~~~
> drivers/net/ethernet/ti/prueth_lre.c:243:35: warning: variable
'status' set but not used [-Wunused-but-set-variable]
243 | u8
overflow_cnt, overflow_cnt_o, status, status_o;
| ^~~~~~
vim +/queue_desc_p +244 drivers/net/ethernet/ti/prueth_lre.c
230
231 static int prueth_lre_emac_rx_packets(struct prueth_emac *emac,
232 int quota, u8 qid1, u8 qid2)
233 {
234 struct prueth *prueth = emac->prueth;
235 void *ocmc_ram = (__force void *)prueth->mem[PRUETH_MEM_OCMC].va;
236 u16 bd_rd_ptr, bd_wr_ptr, update_rd_ptr, bd_rd_ptr_o, bd_wr_ptr_o;
237 void __iomem *shared_ram = prueth->mem[PRUETH_MEM_SHARED_RAM].va;
238 struct prueth_queue_desc __iomem *queue_desc, *queue_desc_o;
239 struct net_device_stats *ndevstats = &emac->ndev->stats;
240 int ret, used = 0, port, port0_q_empty, port1_q_empty;
241 unsigned int emac_max_pktlen = PRUETH_MAX_PKTLEN_LRE;
242 const struct prueth_queue_info *rxqueue, *rxqueue_o;
243 u8 overflow_cnt, overflow_cnt_o, status, status_o;
244 struct prueth_queue_desc __iomem *queue_desc_p;
245 struct
prueth_packet_info pkt_info, pkt_info_o;
246 const struct prueth_queue_info *rxqueue_p;
247 struct prueth_packet_info *pkt_info_p;
248 struct net_device_stats *ndevstats_o;
249 struct net_device_stats *ndevstats_p;
250 u32 rd_buf_desc, rd_buf_desc_o;
251 struct prueth_emac *other_emac;
252 u16 *bd_rd_ptr_p, *bd_wr_ptr_p;
253 struct prueth_emac *emac_p;
254 u32 pkt_ts, pkt_ts_o;
255 u32 iep_wrap;
256
257 other_emac = prueth->emac[(emac->port_id ^ 0x3) - 1];
258 ndevstats_o = &other_emac->ndev->stats;
259
260 /* use the correct wrap value based on ICSSM version */
261 iep_wrap = prueth->fw_offsets->iep_wrap;
262 /* search host queues for packets */
263 queue_desc = emac->rx_queue_descs + qid1;
264 queue_desc_o = other_emac->rx_queue_descs + qid2;
265
266 rxqueue = &sw_queue_infos[PRUETH_PORT_HOST][qid1];
267 rxqueue_o = &sw_queue_infos[PRUETH_PORT_HOST][qid2];
268
269 status = readb(&queue_desc->status);
270 status_o = readb(&queue_desc_o->status);
271
272 overflow_cnt = readb(&queue_desc->overflow_cnt);
273 overflow_cnt_o = readb(&queue_desc_o->overflow_cnt);
274
275 if (overflow_cnt > 0) {
276 emac->ndev->stats.rx_over_errors += overflow_cnt;
277 /* reset to zero */
278 writeb(0, &queue_desc->overflow_cnt);
279 }
280 if (overflow_cnt_o > 0) {
281 other_emac->ndev->stats.rx_over_errors += overflow_cnt_o;
282
283 /* reset to zero */
284 writeb(0, &queue_desc_o->overflow_cnt);
285 }
286
287 bd_rd_ptr = readw(&queue_desc->rd_ptr);
288 bd_wr_ptr = readw(&queue_desc->wr_ptr);
289
290 bd_rd_ptr_o = readw(&queue_desc_o->rd_ptr);
291 bd_wr_ptr_o = readw(&queue_desc_o->wr_ptr);
292
293 port0_q_empty = (bd_rd_ptr == bd_wr_ptr) ? 1 : 0;
294 port1_q_empty = (bd_rd_ptr_o == bd_wr_ptr_o) ? 1 : 0;
295
296 /* while packets are available in this queue */
297 while (!port0_q_empty || !port1_q_empty) {
298 /* get packet info from the read buffer descriptor */
299 rd_buf_desc = readl(shared_ram + bd_rd_ptr);
300 rd_buf_desc_o = readl(shared_ram + bd_rd_ptr_o);
301
302 parse_packet_info(prueth, rd_buf_desc, &pkt_info);
303 parse_packet_info(prueth, rd_buf_desc_o, &pkt_info_o);
304
305 pkt_ts = readl(ocmc_ram + ICSS_LRE_TIMESTAMP_ARRAY_OFFSET +
306 bd_rd_ptr - SRAM_START_OFFSET);
307 pkt_ts_o = readl(ocmc_ram + ICSS_LRE_TIMESTAMP_ARRAY_OFFSET +
308 bd_rd_ptr_o - SRAM_START_OFFSET);
309
310 if (!port0_q_empty && !port1_q_empty) {
311 /* Packets in both port queues */
312 /* Calculate diff b/n timestamps and account for
313 * wraparound
314 */
315 if (pkt_ts > pkt_ts_o)
316 port = (pkt_ts - pkt_ts_o) > (iep_wrap / 2) ?
317 0 : 1;
318 else
319 port = (pkt_ts_o - pkt_ts) > (iep_wrap / 2) ?
320 1 : 0;
321
322 } else if (!port0_q_empty) {
323 /* Packet(s) in port0 queue only */
324 port = 0;
325 } else {
326 /* Packet(s) in port1 queue only */
327 port = 1;
328 }
329
330 /* Select correct data structures for queue/packet selected */
331 if (port == 0) {
332 pkt_info_p = &pkt_info;
333 bd_wr_ptr_p = &bd_wr_ptr;
334 bd_rd_ptr_p = &bd_rd_ptr;
335 emac_p = emac;
336 ndevstats_p = ndevstats;
337 rxqueue_p = rxqueue;
338 queue_desc_p = queue_desc;
339 } else {
340 pkt_info_p = &pkt_info_o;
341 bd_wr_ptr_p = &bd_wr_ptr_o;
342 bd_rd_ptr_p = &bd_rd_ptr_o;
343 emac_p = other_emac;
344 ndevstats_p = ndevstats_o;
345 rxqueue_p = rxqueue_o;
346 queue_desc_p = queue_desc_o;
347 }
348
349 if ((*pkt_info_p).length <= 0) {
350 /* a packet length of zero will cause us to
351 * never move the read pointer ahead, locking
352 * the driver, so we manually have to move it
353 * to the write pointer, discarding all
354 * remaining packets in this queue. This should
355 * never happen.
356 */
357 update_rd_ptr = *bd_wr_ptr_p;
358 ndevstats_p->rx_length_errors++;
359 } else if ((*pkt_info_p).length > emac_max_pktlen) {
360 /* if the packet is too large we skip it but we
361 * still need to move the read pointer ahead
362 * and assume something is wrong with the read
363 * pointer as the firmware should be filtering
364 * these packets
365 */
366 update_rd_ptr = *bd_wr_ptr_p;
367 ndevstats_p->rx_length_errors++;
368 } else {
369 update_rd_ptr = *bd_rd_ptr_p;
370 ret = emac_rx_packet(emac_p, &update_rd_ptr,
371 *pkt_info_p, rxqueue_p);
372 if (ret)
373 return ret;
374
375 used++;
376 }
377
378 /* after reading the buffer descriptor we clear it
379 * to prevent improperly moved read pointer errors
380 * from simply looking like old packets.
381 */
382
383 /* update read pointer in queue descriptor */
384 if (port == 0) {
385 writel(0, shared_ram + bd_rd_ptr);
386 writew(update_rd_ptr, &queue_desc->rd_ptr);
387 bd_rd_ptr = update_rd_ptr;
388 } else {
389 writel(0, shared_ram + bd_rd_ptr_o);
390 writew(update_rd_ptr, &queue_desc_o->rd_ptr);
391 bd_rd_ptr_o = update_rd_ptr;
392 }
393
394 port0_q_empty = (bd_rd_ptr == bd_wr_ptr) ? 1 : 0;
395 port1_q_empty = (bd_rd_ptr_o == bd_wr_ptr_o) ? 1 : 0;
396
397 /* all we have room for? */
398 if (used >= quota)
399 return used;
400 }
401
402 return used;
403 }
404
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org