From: sunil.kovvuri@gmail.com
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sunil Goutham <sgoutham@cavium.com>
Subject: [PATCH v2 14/21] net: thunderx: Use skb_add_rx_frag() for split buffer Rx pkts
Date: Fri, 12 Aug 2016 16:51:37 +0530 [thread overview]
Message-ID: <1471000904-21715-15-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com>
From: Sunil Goutham <sgoutham@cavium.com>
Instead of a round about way of converting buffers to SKBs and
combining them into a frag list, use standard skb_add_rx_frag()
API to merge page fragments. This code is useful when incoming
packets are of size more than RCV_FRAG_LEN which is currently
set to 2048bytes.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 24 ++++++----------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index ca223aa..ed2fe72 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -1184,8 +1184,8 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
int frag;
int payload_len = 0;
struct sk_buff *skb = NULL;
- struct sk_buff *skb_frag = NULL;
- struct sk_buff *prev_frag = NULL;
+ struct page *page;
+ int offset;
u16 *rb_lens = NULL;
u64 *rb_ptrs = NULL;
@@ -1218,22 +1218,10 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
skb_put(skb, payload_len);
} else {
/* Add fragments */
- skb_frag = nicvf_rb_ptr_to_skb(nic, *rb_ptrs,
- payload_len);
- if (!skb_frag) {
- dev_kfree_skb(skb);
- return NULL;
- }
-
- if (!skb_shinfo(skb)->frag_list)
- skb_shinfo(skb)->frag_list = skb_frag;
- else
- prev_frag->next = skb_frag;
-
- prev_frag = skb_frag;
- skb->len += payload_len;
- skb->data_len += payload_len;
- skb_frag->len = payload_len;
+ page = virt_to_page(phys_to_virt(*rb_ptrs));
+ offset = phys_to_virt(*rb_ptrs) - page_address(page);
+ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
+ offset, payload_len, RCV_FRAG_LEN);
}
/* Next buffer pointer */
rb_ptrs++;
--
2.7.4
next prev parent reply other threads:[~2016-08-12 11:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 11:21 [PATCH v2 00/21] net: thunderx: Support for newer chips and miscellaneous patches sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 01/21] net: thunderx: Moved HW capability info from macros to structure sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 02/21] net: thunderx: Add VNIC's PCI devid on future chips sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 03/21] net: thunderx: Add support for 81xx and 83xx chips sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 04/21] net: thunderx: Set queue count based on number of CPUs sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 05/21] net: thunderx: Enable CQE_RX desc's extension fields sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 06/21] net: thunderx: Enable mailbox interrupts on 81xx/83xx sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 07/21] net: thunderx: Support for different LMAC types within BGX sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 08/21] net: thunderx: Add 81xx support to BGX driver sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 09/21] net: thunderx: Add QSGMII interface type support sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 10/21] net: thunderx: Add RGMII " sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 11/21] net: thunderx: Add support for 16 LMACs of 83xx sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 12/21] net: thunderx: Support for 83xx mixed QLM/DLM config sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 13/21] net: thunderx: Use netdev's name for naming VF's interrupts sunil.kovvuri
2016-08-12 11:21 ` sunil.kovvuri [this message]
2016-08-12 11:21 ` [PATCH v2 15/21] net: thunderx: Improvement for MBX interface debug messages sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 16/21] net: thunderx: Reset RXQ HW stats when interface is brought down sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 17/21] net: thunderx: Don't set mac address for secondary Qset VFs sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 18/21] net: thunderx: Use napi_consume_skb for bulk free sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 19/21] net: thunderx: Configure tunnelling protocol parsing sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 20/21] net: thunderx: Use netdev_rss_key_fill() helper sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 21/21] net: thunderx: Don't set RX_PACKET_DIS while initializing sunil.kovvuri
2016-08-13 19:01 ` [PATCH v2 00/21] net: thunderx: Support for newer chips and miscellaneous patches David Miller
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=1471000904-21715-15-git-send-email-sunil.kovvuri@gmail.com \
--to=sunil.kovvuri@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sgoutham@cavium.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).