Hi Ronak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/Ronak-Doshi/avoid-fragmenting-page-memory-with-netdev_alloc_cache/20210212-082217
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
e4b62cf7559f2ef9a022de235e5a09a8d7ded520
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-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
        # 
https://github.com/0day-ci/linux/commit/9f45ca1995ce8958b4ee24fcdc80639314ce25aa
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Ronak-Doshi/avoid-fragmenting-page-memory-with-netdev_alloc_cache/20210212-082217
        git checkout 9f45ca1995ce8958b4ee24fcdc80639314ce25aa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_rq_rx_complete':
>> drivers/net/vmxnet3/vmxnet3_drv.c:1402:8: warning: variable 'len' set but 
>> not used [-Wunused-but-set-variable]
    1402 |    u16 len;
         |        ^~~


vim +/len +1402 drivers/net/vmxnet3/vmxnet3_drv.c

45dac1d6ea045a Shreyas Bhatewara  2015-06-19  1343  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1344  static int
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1345  
vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1346                     struct 
vmxnet3_adapter *adapter, int quota)
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1347  {
215faf9c5f6e31 Joe Perches        2010-12-21  1348      static const u32 
rxprod_reg[2] = {
215faf9c5f6e31 Joe Perches        2010-12-21  1349              
VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2
215faf9c5f6e31 Joe Perches        2010-12-21  1350      };
0769636cb5b956 Neil Horman        2015-07-07  1351      u32 num_pkts = 0;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1352      bool skip_page_frags = 
false;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1353      struct 
Vmxnet3_RxCompDesc *rcd;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1354      struct vmxnet3_rx_ctx 
*ctx = &rq->rx_ctx;
45dac1d6ea045a Shreyas Bhatewara  2015-06-19  1355      u16 segCnt = 0, mss = 0;
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1356  #ifdef __BIG_ENDIAN_BITFIELD
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1357      struct Vmxnet3_RxDesc 
rxCmdDesc;
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1358      struct 
Vmxnet3_RxCompDesc rxComp;
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1359  #endif
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1360      vmxnet3_getRxComp(rcd, 
&rq->comp_ring.base[rq->comp_ring.next2proc].rcd,
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1361                        
&rxComp);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1362      while (rcd->gen == 
rq->comp_ring.gen) {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1363              struct 
vmxnet3_rx_buf_info *rbi;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1364              struct sk_buff 
*skb, *new_skb = NULL;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1365              struct page 
*new_page = NULL;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1366              dma_addr_t 
new_dma_addr;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1367              int 
num_to_alloc;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1368              struct 
Vmxnet3_RxDesc *rxd;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1369              u32 idx, 
ring_idx;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1370              struct 
vmxnet3_cmd_ring *ring = NULL;
0769636cb5b956 Neil Horman        2015-07-07  1371              if (num_pkts >= 
quota) {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1372                      /* we 
may stop even before we see the EOP desc of
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1373                       * the 
current pkt
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1374                       */
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1375                      break;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1376              }
f3002c1374fb23 hp...@vmware.com   2018-05-14  1377  
f3002c1374fb23 hp...@vmware.com   2018-05-14  1378              /* Prevent any 
rcd field from being (speculatively) read before
f3002c1374fb23 hp...@vmware.com   2018-05-14  1379               * rcd->gen is 
read.
f3002c1374fb23 hp...@vmware.com   2018-05-14  1380               */
f3002c1374fb23 hp...@vmware.com   2018-05-14  1381              dma_rmb();
f3002c1374fb23 hp...@vmware.com   2018-05-14  1382  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1383              
BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2 &&
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1384                     
rcd->rqID != rq->dataRingQid);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1385              idx = 
rcd->rxdIdx;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1386              ring_idx = 
VMXNET3_GET_RING_IDX(adapter, rcd->rqID);
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1387              ring = 
rq->rx_ring + ring_idx;
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1388              
vmxnet3_getRxDesc(rxd, &rq->rx_ring[ring_idx].base[idx].rxd,
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1389                              
  &rxCmdDesc);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1390              rbi = 
rq->buf_info[ring_idx] + idx;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1391  
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1392              
BUG_ON(rxd->addr != rbi->dma_addr ||
115924b6bdc7cc Shreyas Bhatewara  2009-11-16  1393                     rxd->len 
!= rbi->len);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1394  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1395              if 
(unlikely(rcd->eop && rcd->err)) {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1396                      
vmxnet3_rx_error(rq, rcd, ctx, adapter);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1397                      goto 
rcd_done;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1398              }
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1399  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1400              if (rcd->sop) { 
/* first buf of the pkt */
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1401                      bool 
rxDataRingUsed;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16 @1402                      u16 len;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1403  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1404                      
BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_HEAD ||
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1405                             
(rcd->rqID != rq->qid &&
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1406                              
rcd->rqID != rq->dataRingQid));
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1407  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1408                      
BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_SKB);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1409                      
BUG_ON(ctx->skb != NULL || rbi->skb == NULL);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1410  
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1411                      if 
(unlikely(rcd->len == 0)) {
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1412                              
/* Pretend the rx buffer is skipped. */
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1413                              
BUG_ON(!(rcd->sop && rcd->eop));
fdcd79b94b2441 Stephen Hemminger  2013-01-15  1414                              
netdev_dbg(adapter->netdev,
f6965582ac9b87 Randy Dunlap       2009-10-16  1415                              
        "rxRing[%u][%u] 0 length\n",
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1416                              
        ring_idx, idx);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1417                              
goto rcd_done;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1418                      }
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1419  
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1420                      
skip_page_frags = false;
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1421                      
ctx->skb = rbi->skb;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1422  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1423                      
rxDataRingUsed =
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1424                              
VMXNET3_RX_DATA_RING(adapter, rcd->rqID);
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1425                      len = 
rxDataRingUsed ? rcd->len : rbi->len;
9f45ca1995ce89 Todd Sabin         2021-02-11  1426                      new_skb 
= ___netdev_alloc_skb(adapter->netdev,
9f45ca1995ce89 Todd Sabin         2021-02-11  1427                              
                      rbi->len + NET_IP_ALIGN, GFP_ATOMIC,
9f45ca1995ce89 Todd Sabin         2021-02-11  1428                              
                      &adapter->frag_cache[rq->qid]);
9f45ca1995ce89 Todd Sabin         2021-02-11  1429                      if 
(NET_IP_ALIGN && new_skb)
9f45ca1995ce89 Todd Sabin         2021-02-11  1430                              
skb_reserve(new_skb, NET_IP_ALIGN);
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1431                      if 
(new_skb == NULL) {
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1432                              
/* Skb allocation failed, do not handover this
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1433                              
 * skb to stack. Reuse it. Drop the existing pkt
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1434                              
 */
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1435                              
rq->stats.rx_buf_alloc_failure++;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1436                              
ctx->skb = NULL;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1437                              
rq->stats.drop_total++;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1438                              
skip_page_frags = true;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1439                              
goto rcd_done;
5318d809d7b497 Shreyas Bhatewara  2011-07-05  1440                      }
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1441  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1442                      if 
(rxDataRingUsed) {
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1443                              
size_t sz;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1444  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1445                              
BUG_ON(rcd->len > rq->data_ring.desc_size);
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1446  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1447                              
ctx->skb = new_skb;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1448                              
sz = rcd->rxdIdx * rq->data_ring.desc_size;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1449                              
memcpy(new_skb->data,
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1450                              
       &rq->data_ring.base[sz], rcd->len);
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1451                      } else {
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1452                              
ctx->skb = rbi->skb;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1453  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1454                              
new_dma_addr =
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1455                              
        dma_map_single(&adapter->pdev->dev,
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1456                              
                       new_skb->data, rbi->len,
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1457                              
                       PCI_DMA_FROMDEVICE);
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1458                              
if (dma_mapping_error(&adapter->pdev->dev,
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1459                              
                      new_dma_addr)) {
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1460                              
        dev_kfree_skb(new_skb);
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1461                              
        /* Skb allocation failed, do not
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1462                              
         * handover this skb to stack. Reuse
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1463                              
         * it. Drop the existing pkt.
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1464                              
         */
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1465                              
        rq->stats.rx_buf_alloc_failure++;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1466                              
        ctx->skb = NULL;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1467                              
        rq->stats.drop_total++;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1468                              
        skip_page_frags = true;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1469                              
        goto rcd_done;
5738a09d58d5ad Alexey Khoroshilov 2015-11-28  1470                              
}
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1471  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1472                              
dma_unmap_single(&adapter->pdev->dev,
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1473                              
                 rbi->dma_addr,
b0eb57cb97e783 Andy King          2013-08-23  1474                              
                 rbi->len,
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1475                              
                 PCI_DMA_FROMDEVICE);
d1a890fa37f27d Shreyas Bhatewara  2009-10-13  1476  
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1477                              
/* Immediate refill */
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1478                              
rbi->skb = new_skb;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1479                              
rbi->dma_addr = new_dma_addr;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1480                              
rxd->addr = cpu_to_le64(rbi->dma_addr);
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1481                              
rxd->len = rbi->len;
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1482                      }
50a5ce3e7116a7 Shrikrishna Khare  2016-06-16  1483  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to