All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Catherine Sullivan <csully@google.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Yangchun Fu <yangchun@google.com>,
	David Awogbemila <awogbemila@google.com>
Subject: drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used
Date: Wed, 19 May 2021 04:58:28 +0800	[thread overview]
Message-ID: <202105190426.vkvw0aci-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4583 bytes --]

Hi Catherine,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8ac91e6c6033ebc12c5c1e4aa171b81a662bd70f
commit: 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc gve: Add support for raw addressing in the tx path
date:   5 months ago
config: i386-randconfig-r035-20210519 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/google/gve/gve_tx.c: In function 'gve_tx_add_skb_no_copy':
>> drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used [-Wunused-but-set-variable]
     507 |  struct gve_tx_dma_buf *buf;
         |                         ^~~


vim +/buf +507 drivers/net/ethernet/google/gve/gve_tx.c

   497	
   498	static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct gve_tx_ring *tx,
   499					  struct sk_buff *skb)
   500	{
   501		const struct skb_shared_info *shinfo = skb_shinfo(skb);
   502		int hlen, payload_nfrags, l4_hdr_offset;
   503		union gve_tx_desc *pkt_desc, *seg_desc;
   504		struct gve_tx_buffer_state *info;
   505		bool is_gso = skb_is_gso(skb);
   506		u32 idx = tx->req & tx->mask;
 > 507		struct gve_tx_dma_buf *buf;
   508		u64 addr;
   509		u32 len;
   510		int i;
   511	
   512		info = &tx->info[idx];
   513		pkt_desc = &tx->desc[idx];
   514	
   515		l4_hdr_offset = skb_checksum_start_offset(skb);
   516		/* If the skb is gso, then we want only up to the tcp header in the first segment
   517		 * to efficiently replicate on each segment otherwise we want the linear portion
   518		 * of the skb (which will contain the checksum because skb->csum_start and
   519		 * skb->csum_offset are given relative to skb->head) in the first segment.
   520		 */
   521		hlen = is_gso ? l4_hdr_offset + tcp_hdrlen(skb) : skb_headlen(skb);
   522		len = skb_headlen(skb);
   523	
   524		info->skb =  skb;
   525	
   526		addr = dma_map_single(tx->dev, skb->data, len, DMA_TO_DEVICE);
   527		if (unlikely(dma_mapping_error(tx->dev, addr))) {
   528			tx->dma_mapping_error++;
   529			goto drop;
   530		}
   531		buf = &info->buf;
   532		dma_unmap_len_set(buf, len, len);
   533		dma_unmap_addr_set(buf, dma, addr);
   534	
   535		payload_nfrags = shinfo->nr_frags;
   536		if (hlen < len) {
   537			/* For gso the rest of the linear portion of the skb needs to
   538			 * be in its own descriptor.
   539			 */
   540			payload_nfrags++;
   541			gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, l4_hdr_offset,
   542					     1 + payload_nfrags, hlen, addr);
   543	
   544			len -= hlen;
   545			addr += hlen;
   546			idx = (tx->req + 1) & tx->mask;
   547			seg_desc = &tx->desc[idx];
   548			gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   549		} else {
   550			gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, l4_hdr_offset,
   551					     1 + payload_nfrags, hlen, addr);
   552		}
   553	
   554		for (i = 0; i < shinfo->nr_frags; i++) {
   555			const skb_frag_t *frag = &shinfo->frags[i];
   556	
   557			idx = (idx + 1) & tx->mask;
   558			seg_desc = &tx->desc[idx];
   559			len = skb_frag_size(frag);
   560			addr = skb_frag_dma_map(tx->dev, frag, 0, len, DMA_TO_DEVICE);
   561			if (unlikely(dma_mapping_error(tx->dev, addr))) {
   562				tx->dma_mapping_error++;
   563				goto unmap_drop;
   564			}
   565			buf = &tx->info[idx].buf;
   566			tx->info[idx].skb = NULL;
   567			dma_unmap_len_set(buf, len, len);
   568			dma_unmap_addr_set(buf, dma, addr);
   569	
   570			gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   571		}
   572	
   573		return 1 + payload_nfrags;
   574	
   575	unmap_drop:
   576		i += (payload_nfrags == shinfo->nr_frags ? 1 : 2);
   577		while (i--) {
   578			idx--;
   579			gve_tx_unmap_buf(tx->dev, &tx->info[idx & tx->mask]);
   580		}
   581	drop:
   582		tx->dropped_pkt++;
   583		return 0;
   584	}
   585	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35189 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used
Date: Wed, 19 May 2021 04:58:28 +0800	[thread overview]
Message-ID: <202105190426.vkvw0aci-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4709 bytes --]

Hi Catherine,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8ac91e6c6033ebc12c5c1e4aa171b81a662bd70f
commit: 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc gve: Add support for raw addressing in the tx path
date:   5 months ago
config: i386-randconfig-r035-20210519 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/google/gve/gve_tx.c: In function 'gve_tx_add_skb_no_copy':
>> drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used [-Wunused-but-set-variable]
     507 |  struct gve_tx_dma_buf *buf;
         |                         ^~~


vim +/buf +507 drivers/net/ethernet/google/gve/gve_tx.c

   497	
   498	static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct gve_tx_ring *tx,
   499					  struct sk_buff *skb)
   500	{
   501		const struct skb_shared_info *shinfo = skb_shinfo(skb);
   502		int hlen, payload_nfrags, l4_hdr_offset;
   503		union gve_tx_desc *pkt_desc, *seg_desc;
   504		struct gve_tx_buffer_state *info;
   505		bool is_gso = skb_is_gso(skb);
   506		u32 idx = tx->req & tx->mask;
 > 507		struct gve_tx_dma_buf *buf;
   508		u64 addr;
   509		u32 len;
   510		int i;
   511	
   512		info = &tx->info[idx];
   513		pkt_desc = &tx->desc[idx];
   514	
   515		l4_hdr_offset = skb_checksum_start_offset(skb);
   516		/* If the skb is gso, then we want only up to the tcp header in the first segment
   517		 * to efficiently replicate on each segment otherwise we want the linear portion
   518		 * of the skb (which will contain the checksum because skb->csum_start and
   519		 * skb->csum_offset are given relative to skb->head) in the first segment.
   520		 */
   521		hlen = is_gso ? l4_hdr_offset + tcp_hdrlen(skb) : skb_headlen(skb);
   522		len = skb_headlen(skb);
   523	
   524		info->skb =  skb;
   525	
   526		addr = dma_map_single(tx->dev, skb->data, len, DMA_TO_DEVICE);
   527		if (unlikely(dma_mapping_error(tx->dev, addr))) {
   528			tx->dma_mapping_error++;
   529			goto drop;
   530		}
   531		buf = &info->buf;
   532		dma_unmap_len_set(buf, len, len);
   533		dma_unmap_addr_set(buf, dma, addr);
   534	
   535		payload_nfrags = shinfo->nr_frags;
   536		if (hlen < len) {
   537			/* For gso the rest of the linear portion of the skb needs to
   538			 * be in its own descriptor.
   539			 */
   540			payload_nfrags++;
   541			gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, l4_hdr_offset,
   542					     1 + payload_nfrags, hlen, addr);
   543	
   544			len -= hlen;
   545			addr += hlen;
   546			idx = (tx->req + 1) & tx->mask;
   547			seg_desc = &tx->desc[idx];
   548			gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   549		} else {
   550			gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, l4_hdr_offset,
   551					     1 + payload_nfrags, hlen, addr);
   552		}
   553	
   554		for (i = 0; i < shinfo->nr_frags; i++) {
   555			const skb_frag_t *frag = &shinfo->frags[i];
   556	
   557			idx = (idx + 1) & tx->mask;
   558			seg_desc = &tx->desc[idx];
   559			len = skb_frag_size(frag);
   560			addr = skb_frag_dma_map(tx->dev, frag, 0, len, DMA_TO_DEVICE);
   561			if (unlikely(dma_mapping_error(tx->dev, addr))) {
   562				tx->dma_mapping_error++;
   563				goto unmap_drop;
   564			}
   565			buf = &tx->info[idx].buf;
   566			tx->info[idx].skb = NULL;
   567			dma_unmap_len_set(buf, len, len);
   568			dma_unmap_addr_set(buf, dma, addr);
   569	
   570			gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   571		}
   572	
   573		return 1 + payload_nfrags;
   574	
   575	unmap_drop:
   576		i += (payload_nfrags == shinfo->nr_frags ? 1 : 2);
   577		while (i--) {
   578			idx--;
   579			gve_tx_unmap_buf(tx->dev, &tx->info[idx & tx->mask]);
   580		}
   581	drop:
   582		tx->dropped_pkt++;
   583		return 0;
   584	}
   585	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35189 bytes --]

             reply	other threads:[~2021-05-18 20:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 20:58 kernel test robot [this message]
2021-05-18 20:58 ` drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-10-02 20:03 kernel test robot
2021-10-02 20:03 ` kernel test robot
2021-08-28 21:45 kernel test robot
2021-08-28 21:45 ` kernel test robot
2021-07-19  0:29 kernel test robot
2021-07-19  0:29 ` kernel test robot
2021-01-16 20:18 kernel test robot
2021-01-16 20:18 ` kernel test robot
2021-01-01 16:59 kernel test robot
2021-01-01 16:59 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202105190426.vkvw0aci-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=awogbemila@google.com \
    --cc=csully@google.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangchun@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.