From patchwork Fri Aug 12 11:21:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9276789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 259FF600CB for ; Fri, 12 Aug 2016 11:27:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15AE928939 for ; Fri, 12 Aug 2016 11:27:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A36E2897B; Fri, 12 Aug 2016 11:27:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7880528939 for ; Fri, 12 Aug 2016 11:27:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYAab-0006t0-QI; Fri, 12 Aug 2016 11:25:25 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYAYa-0004K0-4a for linux-arm-kernel@lists.infradead.org; Fri, 12 Aug 2016 11:23:26 +0000 Received: by mail-pa0-x241.google.com with SMTP id cf3so1359332pad.2 for ; Fri, 12 Aug 2016 04:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=df3Stj/7l+oEV6v+mtzBYGHRfudAfcl246dPcMY2BNg=; b=d60zvQe1TzJZC7TjSs1nR5hr9QkoiKQNRJsjm7BMYmP9VWVd1sEnGeFThsejCjpGn6 QHsPPn0kRroDAl9SopH5OR5ZLNYC3nwv9ulSikIvD5pDfgZO+i5xMEwN8i2Si7drmVFn WzFe3Pps3x2TWxtNr8qSXAmW/KYJ0G5dAtAARdVlhCgmgmtHVRk3LeLiN8Mf6f6A0j3+ Sm5ZaMWFv7uSjsHl335M9Zl/Kh1lOf1SU6P0q0nkXRW+gCWZ3NzA1ciqR5ucYwtsj+Lm sD9yWW/B6a485ida5h1XQiAwyazC762LtIoGQVwYGR+nIJ8ryRmgO4QT44pCypjTYf+B oXrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=df3Stj/7l+oEV6v+mtzBYGHRfudAfcl246dPcMY2BNg=; b=I1fWJWDHDlnPWx/rQWTjMhGmYFVDUfdmm7g8AaFWM9N62WBAW/vHK7obYpj0Ja5TLp ZApl9QFkEu0kG2lhmpMQPj99xZPNNeW7990We4397d8gk6vpU34/KeLYpGolbTYjwvyp 4avOWxMPUUIH8/0ilIKuMhyrp2NwAUoIvP2stTJI1Y2FU/I3Szui19hEeS2jILsaNEvU xXFbq+XZyiEq7OUucG0Qlx1hNgipoQ2tqOEk5xvIGbQ+2bW3jwjK7HDP8h/Uw5IMHac/ whpJmqlysxu6CTWWn7q6/Ag+6r0Z0olLO4g1mkHSQBI4XM/8UMDkqQiA9llzVT/4GgQJ W91w== X-Gm-Message-State: AEkoouvCfFQ/bfxvTW9342VY6Kmqzvk3jRxrFORaS2ezQvsX/7D+qsHNQS770EavhElw1Q== X-Received: by 10.66.193.163 with SMTP id hp3mr26501888pac.73.1471000978900; Fri, 12 Aug 2016 04:22:58 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id ww14sm12306817pac.34.2016.08.12.04.22.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Aug 2016 04:22:58 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org 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 Message-Id: <1471000904-21715-15-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com> References: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160812_042320_629065_1C67A0C6 X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil Goutham , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham 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 --- 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++;