* [jpirko-mlxsw:combined_queue 46/59] drivers/net/ethernet/mellanox/mlxsw/pci.c:2539:7: warning: variable 'i' is uninitialized when used here
@ 2024-12-18 16:29 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-18 16:29 UTC (permalink / raw)
To: Amit Cohen; +Cc: llvm, oe-kbuild-all, Petr Machata, Ido Schimmel
tree: https://github.com/jpirko/linux_mlxsw combined_queue
head: 67f57c974213a49868d8eabd492bd7446ae62abb
commit: f060e27d09ce98effbe55f69411e8cbb90f9921a [46/59] mlxsw: Handle DMA mapping in mlxsw_pci_xdp_frame_transmit()
config: arm-randconfig-003-20241218 (https://download.01.org/0day-ci/archive/20241219/202412190046.DlPYWIKy-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241219/202412190046.DlPYWIKy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412190046.DlPYWIKy-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/mellanox/mlxsw/pci.c:2539:7: warning: variable 'i' is uninitialized when used here [-Wuninitialized]
2539 | for (i++; i < MLXSW_PCI_WQE_SG_ENTRIES; i++)
| ^
drivers/net/ethernet/mellanox/mlxsw/pci.c:2495:16: note: initialize the variable 'i' to silence this warning
2495 | int err = 0, i;
| ^
| = 0
1 warning generated.
vim +/i +2539 drivers/net/ethernet/mellanox/mlxsw/pci.c
f060e27d09ce98e Amit Cohen 2024-12-10 2485
f060e27d09ce98e Amit Cohen 2024-12-10 2486 int __mlxsw_pci_xdp_frame_transmit(struct mlxsw_pci *mlxsw_pci,
45cbc637d94b343 Amit Cohen 2024-11-27 2487 struct xdp_frame *xdpf,
f060e27d09ce98e Amit Cohen 2024-12-10 2488 const struct mlxsw_txhdr_info *txhdr_info,
f060e27d09ce98e Amit Cohen 2024-12-10 2489 bool dma_map)
45cbc637d94b343 Amit Cohen 2024-11-27 2490 {
45cbc637d94b343 Amit Cohen 2024-11-27 2491 struct mlxsw_pci_queue_elem_info *elem_info;
45cbc637d94b343 Amit Cohen 2024-11-27 2492 struct pci_dev *pdev = mlxsw_pci->pdev;
45cbc637d94b343 Amit Cohen 2024-11-27 2493 struct skb_shared_info *sinfo;
45cbc637d94b343 Amit Cohen 2024-11-27 2494 struct mlxsw_pci_queue *q;
45cbc637d94b343 Amit Cohen 2024-11-27 2495 int err = 0, i;
45cbc637d94b343 Amit Cohen 2024-11-27 2496 char *wqe;
45cbc637d94b343 Amit Cohen 2024-11-27 2497
45cbc637d94b343 Amit Cohen 2024-11-27 2498 if (xdpf->headroom < MLXSW_TXHDR_LEN) {
45cbc637d94b343 Amit Cohen 2024-11-27 2499 dev_err_ratelimited(&pdev->dev,
45cbc637d94b343 Amit Cohen 2024-11-27 2500 "Failed to transmit XDP frame, not enough headroom for Tx header\n");
45cbc637d94b343 Amit Cohen 2024-11-27 2501 return -EINVAL;
45cbc637d94b343 Amit Cohen 2024-11-27 2502 }
45cbc637d94b343 Amit Cohen 2024-11-27 2503
45cbc637d94b343 Amit Cohen 2024-11-27 2504 sinfo = xdp_get_shared_info_from_frame(xdpf);
45cbc637d94b343 Amit Cohen 2024-11-27 2505 if (unlikely(sinfo->nr_frags > MLXSW_PCI_WQE_SG_ENTRIES - 1)) {
45cbc637d94b343 Amit Cohen 2024-11-27 2506 dev_err_ratelimited(&pdev->dev,
45cbc637d94b343 Amit Cohen 2024-11-27 2507 "Failed to transmit XDP frame, %d fragments are not supported\n", sinfo->nr_frags);
45cbc637d94b343 Amit Cohen 2024-11-27 2508 return -EINVAL;
45cbc637d94b343 Amit Cohen 2024-11-27 2509 }
45cbc637d94b343 Amit Cohen 2024-11-27 2510
45cbc637d94b343 Amit Cohen 2024-11-27 2511 xdpf->data -= MLXSW_TXHDR_LEN;
45cbc637d94b343 Amit Cohen 2024-11-27 2512 xdpf->headroom -= MLXSW_TXHDR_LEN;
45cbc637d94b343 Amit Cohen 2024-11-27 2513 xdpf->len += MLXSW_TXHDR_LEN;
45cbc637d94b343 Amit Cohen 2024-11-27 2514
45cbc637d94b343 Amit Cohen 2024-11-27 2515 mlxsw_pci_txhdr_construct(xdpf->data, txhdr_info);
45cbc637d94b343 Amit Cohen 2024-11-27 2516
45cbc637d94b343 Amit Cohen 2024-11-27 2517 q = mlxsw_pci_sdq_get(mlxsw_pci, MLXSW_PCI_SDQ_RESERVED_INDEX_XDP);
45cbc637d94b343 Amit Cohen 2024-11-27 2518 spin_lock(&q->lock);
45cbc637d94b343 Amit Cohen 2024-11-27 2519
45cbc637d94b343 Amit Cohen 2024-11-27 2520 elem_info = mlxsw_pci_tx_elem_info_get(q);
45cbc637d94b343 Amit Cohen 2024-11-27 2521 if (!elem_info) {
45cbc637d94b343 Amit Cohen 2024-11-27 2522 err = -EAGAIN;
45cbc637d94b343 Amit Cohen 2024-11-27 2523 goto unlock;
45cbc637d94b343 Amit Cohen 2024-11-27 2524 }
45cbc637d94b343 Amit Cohen 2024-11-27 2525
45cbc637d94b343 Amit Cohen 2024-11-27 2526 elem_info->sdq.xdpf = xdpf;
45cbc637d94b343 Amit Cohen 2024-11-27 2527
45cbc637d94b343 Amit Cohen 2024-11-27 2528 wqe = elem_info->elem;
45cbc637d94b343 Amit Cohen 2024-11-27 2529
f060e27d09ce98e Amit Cohen 2024-12-10 2530 if (dma_map) {
f060e27d09ce98e Amit Cohen 2024-12-10 2531 err = mlxsw_pci_xdp_frame_wqe_map(mlxsw_pci, elem_info, xdpf);
f060e27d09ce98e Amit Cohen 2024-12-10 2532 if (err)
f060e27d09ce98e Amit Cohen 2024-12-10 2533 goto unlock;
f060e27d09ce98e Amit Cohen 2024-12-10 2534 } else {
f060e27d09ce98e Amit Cohen 2024-12-10 2535 mlxsw_pci_xdp_frame_wqe_set(mlxsw_pci, wqe, xdpf);
45cbc637d94b343 Amit Cohen 2024-11-27 2536 }
45cbc637d94b343 Amit Cohen 2024-11-27 2537
45cbc637d94b343 Amit Cohen 2024-11-27 2538 /* Set unused sq entries byte count to zero. */
45cbc637d94b343 Amit Cohen 2024-11-27 @2539 for (i++; i < MLXSW_PCI_WQE_SG_ENTRIES; i++)
45cbc637d94b343 Amit Cohen 2024-11-27 2540 mlxsw_pci_wqe_byte_count_set(wqe, i, 0);
45cbc637d94b343 Amit Cohen 2024-11-27 2541
eea8ab714dbebb8 Amit Cohen 2024-12-10 2542 /* Increase the counter, ringing the doorbell will be done later for
eea8ab714dbebb8 Amit Cohen 2024-12-10 2543 * several frames.
eea8ab714dbebb8 Amit Cohen 2024-12-10 2544 */
45cbc637d94b343 Amit Cohen 2024-11-27 2545 q->producer_counter++;
45cbc637d94b343 Amit Cohen 2024-11-27 2546
45cbc637d94b343 Amit Cohen 2024-11-27 2547 unlock:
45cbc637d94b343 Amit Cohen 2024-11-27 2548 spin_unlock(&q->lock);
45cbc637d94b343 Amit Cohen 2024-11-27 2549 return err;
45cbc637d94b343 Amit Cohen 2024-11-27 2550 }
45cbc637d94b343 Amit Cohen 2024-11-27 2551
:::::: The code at line 2539 was first introduced by commit
:::::: 45cbc637d94b34316ad74857c3ea6fcd7dd44439 mlxsw: pci: Support transmitting XDP frame
:::::: TO: Amit Cohen <amcohen@nvidia.com>
:::::: CC: Petr Machata <petrm@nvidia.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-18 16:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 16:29 [jpirko-mlxsw:combined_queue 46/59] drivers/net/ethernet/mellanox/mlxsw/pci.c:2539:7: warning: variable 'i' is uninitialized when used here kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox