[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202203201751.yZWkjAof-lkp@intel.com>
Date: Sun, 20 Mar 2022 17:47:16 +0800
From: kernel test robot <lkp@...el.com>
To: Michael Chan <michael.chan@...adcom.com>, davem@...emloft.net
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
netdev@...r.kernel.org, kuba@...nel.org, gospo@...adcom.com
Subject: Re: [PATCH net-next 01/11] bnxt: refactor bnxt_rx_xdp to separate
xdp_init_buff/xdp_prepare_buff
Hi Michael,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Michael-Chan/bnxt-Support-XDP-multi-buffer/20220320-150017
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 092d992b76ed9d06389af0bc5efd5279d7b1ed9f
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220320/202203201751.yZWkjAof-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
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
# https://github.com/0day-ci/linux/commit/a00a69739b9d83e22d8fd2404e50a886e4e99944
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Michael-Chan/bnxt-Support-XDP-multi-buffer/20220320-150017
git checkout a00a69739b9d83e22d8fd2404e50a886e4e99944
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/broadcom/bnxt/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c:200:36: warning: variable 'mapping' is uninitialized when used here [-Wuninitialized]
dma_unmap_page_attrs(&pdev->dev, mapping,
^~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c:145:20: note: initialize the variable 'mapping' to silence this warning
dma_addr_t mapping;
^
= 0
1 warning generated.
vim +/mapping +200 drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
a00a69739b9d83 Andy Gospodarek 2022-03-20 133
c6d30e8391b85e Michael Chan 2017-02-06 134 /* returns the following:
c6d30e8391b85e Michael Chan 2017-02-06 135 * true - packet consumed by XDP and new buffer is allocated.
c6d30e8391b85e Michael Chan 2017-02-06 136 * false - packet should be passed to the stack.
c6d30e8391b85e Michael Chan 2017-02-06 137 */
c6d30e8391b85e Michael Chan 2017-02-06 138 bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
a00a69739b9d83 Andy Gospodarek 2022-03-20 139 struct xdp_buff xdp, struct page *page, unsigned int *len, u8 *event)
c6d30e8391b85e Michael Chan 2017-02-06 140 {
c6d30e8391b85e Michael Chan 2017-02-06 141 struct bpf_prog *xdp_prog = READ_ONCE(rxr->xdp_prog);
38413406277fd0 Michael Chan 2017-02-06 142 struct bnxt_tx_ring_info *txr;
c6d30e8391b85e Michael Chan 2017-02-06 143 struct bnxt_sw_rx_bd *rx_buf;
c6d30e8391b85e Michael Chan 2017-02-06 144 struct pci_dev *pdev;
c6d30e8391b85e Michael Chan 2017-02-06 145 dma_addr_t mapping;
c6d30e8391b85e Michael Chan 2017-02-06 146 void *orig_data;
38413406277fd0 Michael Chan 2017-02-06 147 u32 tx_avail;
c6d30e8391b85e Michael Chan 2017-02-06 148 u32 offset;
c6d30e8391b85e Michael Chan 2017-02-06 149 u32 act;
c6d30e8391b85e Michael Chan 2017-02-06 150
c6d30e8391b85e Michael Chan 2017-02-06 151 if (!xdp_prog)
c6d30e8391b85e Michael Chan 2017-02-06 152 return false;
c6d30e8391b85e Michael Chan 2017-02-06 153
c6d30e8391b85e Michael Chan 2017-02-06 154 pdev = bp->pdev;
c6d30e8391b85e Michael Chan 2017-02-06 155 offset = bp->rx_offset;
c6d30e8391b85e Michael Chan 2017-02-06 156
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 157 txr = rxr->bnapi->tx_ring;
43b5169d8355cc Lorenzo Bianconi 2020-12-22 158 /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */
c6d30e8391b85e Michael Chan 2017-02-06 159 orig_data = xdp.data;
c6d30e8391b85e Michael Chan 2017-02-06 160
c6d30e8391b85e Michael Chan 2017-02-06 161 act = bpf_prog_run_xdp(xdp_prog, &xdp);
c6d30e8391b85e Michael Chan 2017-02-06 162
38413406277fd0 Michael Chan 2017-02-06 163 tx_avail = bnxt_tx_avail(bp, txr);
38413406277fd0 Michael Chan 2017-02-06 164 /* If the tx ring is not full, we must not update the rx producer yet
38413406277fd0 Michael Chan 2017-02-06 165 * because we may still be transmitting on some BDs.
38413406277fd0 Michael Chan 2017-02-06 166 */
38413406277fd0 Michael Chan 2017-02-06 167 if (tx_avail != bp->tx_ring_size)
38413406277fd0 Michael Chan 2017-02-06 168 *event &= ~BNXT_RX_EVENT;
38413406277fd0 Michael Chan 2017-02-06 169
b968e735c79767 Nikita V. Shirokov 2018-04-17 170 *len = xdp.data_end - xdp.data;
a00a69739b9d83 Andy Gospodarek 2022-03-20 171 if (orig_data != xdp.data)
c6d30e8391b85e Michael Chan 2017-02-06 172 offset = xdp.data - xdp.data_hard_start;
a00a69739b9d83 Andy Gospodarek 2022-03-20 173
c6d30e8391b85e Michael Chan 2017-02-06 174 switch (act) {
c6d30e8391b85e Michael Chan 2017-02-06 175 case XDP_PASS:
c6d30e8391b85e Michael Chan 2017-02-06 176 return false;
c6d30e8391b85e Michael Chan 2017-02-06 177
38413406277fd0 Michael Chan 2017-02-06 178 case XDP_TX:
a00a69739b9d83 Andy Gospodarek 2022-03-20 179 rx_buf = &rxr->rx_buf_ring[cons];
a00a69739b9d83 Andy Gospodarek 2022-03-20 180 mapping = rx_buf->mapping - bp->rx_dma_offset;
a00a69739b9d83 Andy Gospodarek 2022-03-20 181
932dbf83ba18bd Michael Chan 2017-04-04 182 if (tx_avail < 1) {
38413406277fd0 Michael Chan 2017-02-06 183 trace_xdp_exception(bp->dev, xdp_prog, act);
38413406277fd0 Michael Chan 2017-02-06 184 bnxt_reuse_rx_data(rxr, cons, page);
38413406277fd0 Michael Chan 2017-02-06 185 return true;
38413406277fd0 Michael Chan 2017-02-06 186 }
38413406277fd0 Michael Chan 2017-02-06 187
38413406277fd0 Michael Chan 2017-02-06 188 *event = BNXT_TX_EVENT;
38413406277fd0 Michael Chan 2017-02-06 189 dma_sync_single_for_device(&pdev->dev, mapping + offset, *len,
38413406277fd0 Michael Chan 2017-02-06 190 bp->rx_dir);
52c0609258658f Andy Gospodarek 2019-07-08 191 __bnxt_xmit_xdp(bp, txr, mapping + offset, *len,
38413406277fd0 Michael Chan 2017-02-06 192 NEXT_RX(rxr->rx_prod));
38413406277fd0 Michael Chan 2017-02-06 193 bnxt_reuse_rx_data(rxr, cons, page);
38413406277fd0 Michael Chan 2017-02-06 194 return true;
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 195 case XDP_REDIRECT:
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 196 /* if we are calling this here then we know that the
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 197 * redirect is coming from a frame received by the
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 198 * bnxt_en driver.
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 199 */
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 @200 dma_unmap_page_attrs(&pdev->dev, mapping,
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 201 PAGE_SIZE, bp->rx_dir,
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 202 DMA_ATTR_WEAK_ORDERING);
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 203
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 204 /* if we are unable to allocate a new buffer, abort and reuse */
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 205 if (bnxt_alloc_rx_data(bp, rxr, rxr->rx_prod, GFP_ATOMIC)) {
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 206 trace_xdp_exception(bp->dev, xdp_prog, act);
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 207 bnxt_reuse_rx_data(rxr, cons, page);
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 208 return true;
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 209 }
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 210
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 211 if (xdp_do_redirect(bp->dev, &xdp, xdp_prog)) {
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 212 trace_xdp_exception(bp->dev, xdp_prog, act);
322b87ca55f2f3 Andy Gospodarek 2019-07-08 213 page_pool_recycle_direct(rxr->page_pool, page);
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 214 return true;
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 215 }
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 216
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 217 *event |= BNXT_REDIRECT_EVENT;
f18c2b77b2e4ee Andy Gospodarek 2019-07-08 218 break;
c6d30e8391b85e Michael Chan 2017-02-06 219 default:
c8064e5b4adac5 Paolo Abeni 2021-11-30 220 bpf_warn_invalid_xdp_action(bp->dev, xdp_prog, act);
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 221 fallthrough;
c6d30e8391b85e Michael Chan 2017-02-06 222 case XDP_ABORTED:
c6d30e8391b85e Michael Chan 2017-02-06 223 trace_xdp_exception(bp->dev, xdp_prog, act);
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 224 fallthrough;
c6d30e8391b85e Michael Chan 2017-02-06 225 case XDP_DROP:
c6d30e8391b85e Michael Chan 2017-02-06 226 bnxt_reuse_rx_data(rxr, cons, page);
c6d30e8391b85e Michael Chan 2017-02-06 227 break;
c6d30e8391b85e Michael Chan 2017-02-06 228 }
c6d30e8391b85e Michael Chan 2017-02-06 229 return true;
c6d30e8391b85e Michael Chan 2017-02-06 230 }
c6d30e8391b85e Michael Chan 2017-02-06 231
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists