linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Coiby Xu <coiby.xu@gmail.com>
To: linux-staging@lists.linux.dev
Cc: netdev@vger.kernel.org,
	Benjamin Poirier <benjamin.poirier@gmail.com>,
	Shung-Hsi Yu <shung-hsi.yu@suse.com>,
	Manish Chopra <manishc@marvell.com>,
	GR-Linux-NIC-Dev@marvell.com (supporter:QLOGIC QLGE 10Gb
	ETHERNET DRIVER), Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org (open list)
Subject: [RFC 16/19] staging: qlge: remove deadcode in qlge_build_rx_skb
Date: Mon, 21 Jun 2021 21:48:59 +0800	[thread overview]
Message-ID: <20210621134902.83587-17-coiby.xu@gmail.com> (raw)
In-Reply-To: <20210621134902.83587-1-coiby.xu@gmail.com>

This part of code is for the case that "the headers and data are in
a single large buffer". However, qlge_process_mac_split_rx_intr is for
handling packets that packets underwent head splitting. In reality, with
jumbo frame enabled, the part of code couldn't be reached regardless of
the packet size when ping the NIC.

Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
---
 drivers/staging/qlge/TODO        |  6 ---
 drivers/staging/qlge/qlge_main.c | 66 ++++++++------------------------
 2 files changed, 17 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/qlge/TODO b/drivers/staging/qlge/TODO
index 4575f35114bf..0f96186ed77c 100644
--- a/drivers/staging/qlge/TODO
+++ b/drivers/staging/qlge/TODO
@@ -1,9 +1,3 @@
-* commit 7c734359d350 ("qlge: Size RX buffers based on MTU.", v2.6.33-rc1)
-  introduced dead code in the receive routines, which should be rewritten
-  anyways by the admission of the author himself, see the comment above
-  ql_build_rx_skb(). That function is now used exclusively to handle packets
-  that underwent header splitting but it still contains code to handle non
-  split cases.
 * the driver has a habit of using runtime checks where compile time checks are
   possible (ex. ql_free_rx_buffers(), ql_alloc_rx_buffers())
 * remove duplicate and useless comments
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 904dba7aaee5..e560006225ca 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -1741,55 +1741,23 @@ static struct sk_buff *qlge_build_rx_skb(struct qlge_adapter *qdev,
 			sbq_desc->p.skb = NULL;
 		}
 	} else if (ib_mac_rsp->flags3 & IB_MAC_IOCB_RSP_DL) {
-		if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HS) {
-			netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
-				     "Header in small, %d bytes in large. Chain large to small!\n",
-				     length);
-			/*
-			 * The data is in a single large buffer.  We
-			 * chain it to the header buffer's skb and let
-			 * it rip.
-			 */
-			lbq_desc = qlge_get_curr_lchunk(qdev, rx_ring);
-			netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
-				     "Chaining page at offset = %d, for %d bytes  to skb.\n",
-				     lbq_desc->p.pg_chunk.offset, length);
-			skb_fill_page_desc(skb, 0, lbq_desc->p.pg_chunk.page,
-					   lbq_desc->p.pg_chunk.offset, length);
-			skb->len += length;
-			skb->data_len += length;
-			skb->truesize += qdev->lbq_buf_size;
-		} else {
-			/*
-			 * The headers and data are in a single large buffer. We
-			 * copy it to a new skb and let it go. This can happen with
-			 * jumbo mtu on a non-TCP/UDP frame.
-			 */
-			lbq_desc = qlge_get_curr_lchunk(qdev, rx_ring);
-			skb = napi_alloc_skb(&rx_ring->napi, QLGE_SMALL_BUFFER_SIZE);
-			if (!skb) {
-				netif_printk(qdev, probe, KERN_DEBUG, qdev->ndev,
-					     "No skb available, drop the packet.\n");
-				return NULL;
-			}
-			dma_unmap_page(&qdev->pdev->dev, lbq_desc->dma_addr,
-				       qdev->lbq_buf_size,
-				       DMA_FROM_DEVICE);
-			skb_reserve(skb, NET_IP_ALIGN);
-			netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
-				     "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n",
-				     length);
-			skb_fill_page_desc(skb, 0, lbq_desc->p.pg_chunk.page,
-					   lbq_desc->p.pg_chunk.offset,
-					   length);
-			skb->len += length;
-			skb->data_len += length;
-			skb->truesize += qdev->lbq_buf_size;
-			qlge_update_mac_hdr_len(qdev, ib_mac_rsp,
-						lbq_desc->p.pg_chunk.va,
-						&hlen);
-			__pskb_pull_tail(skb, hlen);
-		}
+		netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
+			     "Header in small, %d bytes in large. Chain large to small!\n",
+			     length);
+		/*
+		 * The data is in a single large buffer.  We
+		 * chain it to the header buffer's skb and let
+		 * it rip.
+		 */
+		lbq_desc = qlge_get_curr_lchunk(qdev, rx_ring);
+		netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev,
+			     "Chaining page at offset = %d, for %d bytes  to skb.\n",
+			     lbq_desc->p.pg_chunk.offset, length);
+		skb_fill_page_desc(skb, 0, lbq_desc->p.pg_chunk.page,
+				   lbq_desc->p.pg_chunk.offset, length);
+		skb->len += length;
+		skb->data_len += length;
+		skb->truesize += qdev->lbq_buf_size;
 	} else {
 		/*
 		 * The data is in a chain of large buffers
-- 
2.32.0


  parent reply	other threads:[~2021-06-21 13:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 13:48 [RFC 00/19] Improve the qlge driver based on drivers/staging/qlge/TODO Coiby Xu
2021-06-21 13:48 ` [RFC 01/19] staging: qlge: fix incorrect truesize accounting Coiby Xu
2021-06-21 14:10   ` Dan Carpenter
2021-06-22 11:36     ` Coiby Xu
2021-06-23  4:55       ` Benjamin Poirier
2021-06-24 11:47         ` Coiby Xu
2021-06-28  0:14           ` Coiby Xu
2021-06-21 13:48 ` [RFC 02/19] staging: qlge: change LARGE_BUFFER_MAX_SIZE to 4096 Coiby Xu
2021-06-21 13:48 ` [RFC 03/19] staging: qlge: alloc skb with only enough room for header when data is put in the fragments Coiby Xu
2021-06-21 13:48 ` [RFC 04/19] staging: qlge: add qlge_* prefix to avoid namespace clashes Coiby Xu
2021-06-22  7:55   ` Benjamin Poirier
2021-06-24 11:34     ` Coiby Xu
2021-06-21 13:48 ` [RFC 05/19] staging: qlge: rename rx to completion queue and seperate rx_ring from completion queue Coiby Xu
2021-06-21 13:48 ` [RFC 06/19] staging: qlge: disable flow control by default Coiby Xu
2021-06-22  7:49   ` Benjamin Poirier
2021-06-24 11:33     ` Coiby Xu
2021-06-21 13:48 ` [RFC 07/19] staging: qlge: remove the TODO item of unnecessary memset 0 Coiby Xu
2021-06-21 13:48 ` [RFC 08/19] staging: qlge: reorder members of qlge_adapter for optimization Coiby Xu
2021-06-21 13:48 ` [RFC 09/19] staging: qlge: remove the TODO item of reorder struct Coiby Xu
2021-06-21 13:48 ` [RFC 10/19] staging: qlge: remove the TODO item of avoid legacy/deprecated apis Coiby Xu
2021-06-21 13:48 ` [RFC 11/19] staging: qlge: the number of pages to contain a buffer queue is constant Coiby Xu
2021-06-21 13:48 ` [RFC 12/19] staging: qlge: rewrite do while loops as for loops in qlge_start_rx_ring Coiby Xu
2021-06-22  7:45   ` Benjamin Poirier
2021-06-24 11:56     ` Coiby Xu
2021-06-21 13:48 ` [RFC 13/19] staging: qlge: rewrite do while loop as for loop in qlge_sem_spinlock Coiby Xu
2021-06-22  7:20   ` Dan Carpenter
2021-06-24 11:22     ` Coiby Xu
2021-06-30 10:58       ` Joe Perches
2021-06-30 23:33         ` Coiby Xu
2021-07-01  4:35           ` Joe Perches
2021-07-02 23:56             ` Coiby Xu
2021-06-21 13:48 ` [RFC 14/19] staging: qlge: rewrite do while loop as for loop in qlge_refill_bq Coiby Xu
2021-06-21 13:48 ` [RFC 15/19] staging: qlge: remove the TODO item about rewriting while loops as simple for loops Coiby Xu
2021-06-21 13:48 ` Coiby Xu [this message]
2021-06-22  7:29   ` [RFC 16/19] staging: qlge: remove deadcode in qlge_build_rx_skb Dan Carpenter
2021-06-24 11:25     ` Coiby Xu
2021-06-24 12:49       ` Dan Carpenter
2021-06-27 10:53         ` Coiby Xu
2021-06-28  6:46           ` Dan Carpenter
2021-06-29 13:35             ` Coiby Xu
2021-06-29 14:22               ` Dan Carpenter
2021-06-30 23:19                 ` Coiby Xu
2021-06-21 13:49 ` [RFC 17/19] staging: qlge: fix weird line wrapping Coiby Xu
2021-06-22  8:46   ` Dan Carpenter
2021-06-24 11:55     ` Coiby Xu
2021-06-21 13:49 ` [RFC 18/19] staging: qlge: fix two indentation issues Coiby Xu
2021-06-21 13:49 ` [RFC 19/19] staging: qlge: remove TODO item of unnecessary runtime checks Coiby Xu

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=20210621134902.83587-17-coiby.xu@gmail.com \
    --to=coiby.xu@gmail.com \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=benjamin.poirier@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=shung-hsi.yu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).