From patchwork Thu Jun 18 03:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 217635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F286C433E0 for ; Thu, 18 Jun 2020 03:53:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F44C21841 for ; Thu, 18 Jun 2020 03:53:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LfDenv0o" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727782AbgFRDxe (ORCPT ); Wed, 17 Jun 2020 23:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbgFRDxd (ORCPT ); Wed, 17 Jun 2020 23:53:33 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21545C06174E for ; Wed, 17 Jun 2020 20:53:33 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id a188so5046739ybg.20 for ; Wed, 17 Jun 2020 20:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=B9ST2pcwYRlVFiUwvCnycs4QvccZohHW4codKg/MZAw=; b=LfDenv0oTiYzR+gn0Zbx8AH2X2n/QS7LSoLMXV5uQjDYE12JeaCQu3B/3aw/ulygzW 0UuNsHo+Ozipfs9Bd74lVZiCeYAS15Yt3CqD/OJpRI8iRfGmkEm5zSWi7jItW+6/THSg ug61F3BJVNQZxixVR+69ThXD52+2bKHdFvtrzFrhFQInVFLLZhJ8nhcx+DJQVCP40w9d qF+NjoITB94JKIBXtVkyOyo1ApmGgESJrKrnqqOwBcb04utkEpJ+kTZxKY+1u9G0aElu SM9zBA3MVKoVbiJC15TqjhZrpMJpUl9+T5aYI2/3TJsSlMDfU49XvTiLjg4M5DYHpexW jvRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=B9ST2pcwYRlVFiUwvCnycs4QvccZohHW4codKg/MZAw=; b=YCAMUrlJQkvT0YJXpWJDiDz5KcM18n8nFiqxFJff58KY1dezKj9Cte2mrMQAUI8x61 vQjJbXoqBsgwQknXXn23zVSHTxTFYsSTAJENu1oc2vcKigjaNrWNBM8is+MX3kEH1rGx gBBuONPegJKvSY2C3JJhiIVzL2uoX4+3hQs6JP1YDvBkxR4zdTvlO2OyHlKt3GlXsB06 zi04bHgd9dEUtcBjucS18GyToiQIUb+33P/CKrJH3ZyfQd2+u8UpsLAKWBuaVImEzVxh DEmyw0/p9G5swCQRJEXUZz8NLyaG+bS6wnysnwEp4eKsoWmdA/95+w0pemO+NFvvVB46 1eMA== X-Gm-Message-State: AOAM530ZVNrb65g5fdhwvXKMb9Siw1PI9MqSKyhP5n/i+7Rg9V5v+6Un ALng2wAfc5GFTLJ9szKkFKloITVKLBd3pw== X-Google-Smtp-Source: ABdhPJwg481d7JhKkf0bN7lBdY0ukxVlBXW0EH65Vb7PbuloX8jjP82RbgXmHYadiIfXkLCc9SKKn9OEV3b/xQ== X-Received: by 2002:a25:3d01:: with SMTP id k1mr3354806yba.510.1592452412212; Wed, 17 Jun 2020 20:53:32 -0700 (PDT) Date: Wed, 17 Jun 2020 20:53:21 -0700 In-Reply-To: <20200618035326.39686-1-edumazet@google.com> Message-Id: <20200618035326.39686-2-edumazet@google.com> Mime-Version: 1.0 References: <20200618035326.39686-1-edumazet@google.com> X-Mailer: git-send-email 2.27.0.290.gba653c62da-goog Subject: [PATCH v2 net-next 1/6] octeontx2-af: change (struct qmem)->entry_sz from u8 to u16 From: Eric Dumazet To: "David S . Miller" Cc: netdev , Eric Dumazet , Eric Dumazet , Jakub Kicinski , Willem de Bruijn , Sunil Goutham , Antoine Tenart Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We need to increase TSO_HEADER_SIZE from 128 to 256. Since otx2_sq_init() calls qmem_alloc() with TSO_HEADER_SIZE, we need to change (struct qmem)->entry_sz to avoid truncation to 0. Fixes: 7a37245ef23f ("octeontx2-af: NPA block admin queue init") Signed-off-by: Eric Dumazet Cc: Sunil Goutham --- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h index cd33c2e6ca5fc25e16ec3b3f036df799471d88d5..f48eb66ed021b052b94d09684008cdb4e6356cd0 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/common.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h @@ -43,7 +43,7 @@ struct qmem { void *base; dma_addr_t iova; int alloc_sz; - u8 entry_sz; + u16 entry_sz; u8 align; u32 qsize; }; From patchwork Thu Jun 18 03:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 217634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A4E6C433E1 for ; Thu, 18 Jun 2020 03:53:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B701214DB for ; Thu, 18 Jun 2020 03:53:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BBFLyWTj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbgFRDxh (ORCPT ); Wed, 17 Jun 2020 23:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbgFRDxg (ORCPT ); Wed, 17 Jun 2020 23:53:36 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD34C06174E for ; Wed, 17 Jun 2020 20:53:35 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id y3so5175844ybf.4 for ; Wed, 17 Jun 2020 20:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=xtNpgjeC+vuPrrXlD/xInlHQ99Epa7kISaCzCK7ILus=; b=BBFLyWTjA4UcGIF898fs50OEhUdx4Do1SaRE8fqUboZU6qAcy3mANiZaVCr6bB62DV Un2LiawTzhyMzM3neKp0pog2p/79TQzniwzmOpELH7BlXybsH1m6lIDJGHjsvcv3AzqL FHUWuH0HhWdvMutw+jom/BzGqaSZcdKz5gKR3veOM/j2+PPyt43KZAGRgZ+OqVS/L8u1 6D96RqAO2rMzj608bSYIqFWcZ74D/NFIQChm7DyrkEXwJdzzSauPjhQds6guG5jUU5tI Zm5QpM9pgZteeurpdBJl1cOKuTKZzPTsL8cYHoBrjsP7p4frUljhIX6Upa0TYFMAUe7T FFHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=xtNpgjeC+vuPrrXlD/xInlHQ99Epa7kISaCzCK7ILus=; b=NTbJlBishA2KBFCdK08jfgAWITHYZh+wu5mMMEQ9VcNT9LbuHBW9KJmzE64xFaFvOs wW33ZgeNW9ic6M64NGldhNlNnCyB+oEnPwJPCBDsxDThN8o33YCXv8iHH6JIjeEKlgwH WiHHJv92O8JaH0TQrsnrNDKirtQVYE7kPQc9bOfqpdgknID0vrrBQq/GEJLEik9/WDD1 iUb0rgrS+yHH99JP9DlH7kXxcaR+IdmGSYg8gp/kSLqH7Xy50SPJe+8d7FYT+0Ssj8D3 IuEIJvFQ45qyBazIiKWIGHFF3YxZ/CqQag16qNPwJOnP380za3Y4hsN5IRAccvyeLY34 qnDA== X-Gm-Message-State: AOAM533jkV40gqr4v8nJc3LXzgQNCT8uzTnFWrMJyxMVpCkU+9Wzfo+a /GVTzhAiG+hB4DhYcKRqtursJoiHzsiSOw== X-Google-Smtp-Source: ABdhPJwWbmFGS5wJS5J3YIIPG+kKNnnq6a5pTytkMBZlJfyu7wNuiRENh+hiB41HymeVT9Q2ffpmSuEWxvaI2g== X-Received: by 2002:a05:6902:4a2:: with SMTP id r2mr3578167ybs.176.1592452414477; Wed, 17 Jun 2020 20:53:34 -0700 (PDT) Date: Wed, 17 Jun 2020 20:53:22 -0700 In-Reply-To: <20200618035326.39686-1-edumazet@google.com> Message-Id: <20200618035326.39686-3-edumazet@google.com> Mime-Version: 1.0 References: <20200618035326.39686-1-edumazet@google.com> X-Mailer: git-send-email 2.27.0.290.gba653c62da-goog Subject: [PATCH v2 net-next 2/6] net: tso: double TSO_HEADER_SIZE value From: Eric Dumazet To: "David S . Miller" Cc: netdev , Eric Dumazet , Eric Dumazet , Jakub Kicinski , Willem de Bruijn , Sunil Goutham , Antoine Tenart Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Transport header size could be 60 bytes, and network header size can also be 60 bytes. Add the Ethernet header and we are above 128 bytes. Since drivers using net/core/tso.c usually allocates one DMA coherent piece of memory per TX queue, this patch might cause issues if a driver was using too many slots. For 1024 slots, we would need 256 KB of physically contiguous memory instead of 128 KB. Alternative fix would be to add checks in the fast path, but this involves more work in all drivers using net/core/tso.c. Fixes: f9cbe9a556af ("net: define the TSO header size in net/tso.h") Signed-off-by: Eric Dumazet Cc: Antoine Tenart --- include/net/tso.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/tso.h b/include/net/tso.h index 7e166a5703497fadf4662acc474f827b2754da78..c33dd00c161f7a6aa65f586b0ceede46af2e8730 100644 --- a/include/net/tso.h +++ b/include/net/tso.h @@ -4,7 +4,7 @@ #include -#define TSO_HEADER_SIZE 128 +#define TSO_HEADER_SIZE 256 struct tso_t { int next_frag_idx; From patchwork Thu Jun 18 03:53:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 217633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0246C433E0 for ; Thu, 18 Jun 2020 03:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B8E4214DB for ; Thu, 18 Jun 2020 03:53:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gKV3+Lb1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727945AbgFRDxt (ORCPT ); Wed, 17 Jun 2020 23:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727914AbgFRDxq (ORCPT ); Wed, 17 Jun 2020 23:53:46 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E60FC061755 for ; Wed, 17 Jun 2020 20:53:46 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id b135so5072655yba.11 for ; Wed, 17 Jun 2020 20:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=MtgJnooZi1N2NHQfNjrP1tRVI5EJU+jkftfAJ6oddAg=; b=gKV3+Lb1baWgfnwT8NlbLRpc/OjJdrckbRYIdoeZJuJz8sXWkKCpqbRPeAzMCxO48L hhSPlgrjW6Fx2S3e5J5kQ6UATxne4OYi120cRCaI6hAinkThetGl8ji6+W0MARbE9fDO /rh+3fBZ2B6leTBaakDaMFR9k2NK6DTvG9PRBswV8VKFbZnSSqaCmzIEIpOoNh9dtg3T qtDrdnidZRR+zUvkrcp+XkdBUqHOCeTgJ36QzL27TsK4GeUe02pwLnDYqMwKOThNPgGZ iwLhazvnwpBcn4MBpmvwnrYAaOr6j/7u6ezrdovF28PunRut1DO/A2drONEyImq8GAa1 XDpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=MtgJnooZi1N2NHQfNjrP1tRVI5EJU+jkftfAJ6oddAg=; b=AVKPJRnL9nmyAFg9twVnwj+eMe7jMgE/3dtbtdHxQMfS78pZi5xLlgvseAlwjT/VSu W+HuSArwIUHAbh1IQqQOTh1FjHXLQML4zXiHqzl1+pmp7rkusvZBdrcAJKrMvka1Uutn 93SLtmQ0iohIg1RksN4Ac/L6a9JzTFDaK6S+wFsCok4R5c7oDWtnsBHkoIp2LjMnZYIA 0cOZDQDTnjVokT/bTHJyNa9gjN5U8lcG4Y9WLRCDIzib8ra65Ud5cWp9b8yUiwA2Y3V6 ggsRL2wV8Dqi65XpvR+VH1T07FS/2J2EUvF4TVkKKvmZZ009DDuESHqfkNrFiW45Pyoo Ibew== X-Gm-Message-State: AOAM533vSTfYCGCONV7h4PdGLOraFkNEGboid6itJcOwFifTZTjlzqiJ MUfG/J62mjNNAwaCcNKB1ADA8OEqoymQPQ== X-Google-Smtp-Source: ABdhPJyHZgB7wyXk1IiFWSpclRCha5f9WlrOBUSsz7zIWkWeJzuL0t+loC+dSbOOPISBOrHbUomdrVcaN5Gp1A== X-Received: by 2002:a05:6902:725:: with SMTP id l5mr3916940ybt.150.1592452425288; Wed, 17 Jun 2020 20:53:45 -0700 (PDT) Date: Wed, 17 Jun 2020 20:53:26 -0700 In-Reply-To: <20200618035326.39686-1-edumazet@google.com> Message-Id: <20200618035326.39686-7-edumazet@google.com> Mime-Version: 1.0 References: <20200618035326.39686-1-edumazet@google.com> X-Mailer: git-send-email 2.27.0.290.gba653c62da-goog Subject: [PATCH v2 net-next 6/6] net: tso: add UDP segmentation support From: Eric Dumazet To: "David S . Miller" Cc: netdev , Eric Dumazet , Eric Dumazet , Jakub Kicinski , Willem de Bruijn , Sunil Goutham , Antoine Tenart Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Note that like TCP, we do not support additional encapsulations, and that checksums must be offloaded to the NIC. Signed-off-by: Eric Dumazet --- net/core/tso.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/net/core/tso.c b/net/core/tso.c index 9f35518815bda275106d27bc5cc34b019429d254..4148f6d48953e1e1ebd878c3953f3e41d47832d9 100644 --- a/net/core/tso.c +++ b/net/core/tso.c @@ -16,7 +16,6 @@ EXPORT_SYMBOL(tso_count_descs); void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso, int size, bool is_last) { - struct tcphdr *tcph; int hdr_len = skb_transport_offset(skb) + tso->tlen; int mac_hdr_len = skb_network_offset(skb); @@ -32,21 +31,29 @@ void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso, iph->payload_len = htons(size + tso->tlen); } - tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb)); - put_unaligned_be32(tso->tcp_seq, &tcph->seq); + hdr += skb_transport_offset(skb); + if (tso->tlen != sizeof(struct udphdr)) { + struct tcphdr *tcph = (struct tcphdr *)hdr; - if (!is_last) { - /* Clear all special flags for not last packet */ - tcph->psh = 0; - tcph->fin = 0; - tcph->rst = 0; + put_unaligned_be32(tso->tcp_seq, &tcph->seq); + + if (!is_last) { + /* Clear all special flags for not last packet */ + tcph->psh = 0; + tcph->fin = 0; + tcph->rst = 0; + } + } else { + struct udphdr *uh = (struct udphdr *)hdr; + + uh->len = htons(sizeof(*uh) + size); } } EXPORT_SYMBOL(tso_build_hdr); void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size) { - tso->tcp_seq += size; + tso->tcp_seq += size; /* not worth avoiding this operation for UDP */ tso->size -= size; tso->data += size; @@ -64,12 +71,12 @@ EXPORT_SYMBOL(tso_build_data); int tso_start(struct sk_buff *skb, struct tso_t *tso) { - int tlen = tcp_hdrlen(skb); + int tlen = skb_is_gso_tcp(skb) ? tcp_hdrlen(skb) : sizeof(struct udphdr); int hdr_len = skb_transport_offset(skb) + tlen; tso->tlen = tlen; tso->ip_id = ntohs(ip_hdr(skb)->id); - tso->tcp_seq = ntohl(tcp_hdr(skb)->seq); + tso->tcp_seq = (tlen != sizeof(struct udphdr)) ? ntohl(tcp_hdr(skb)->seq) : 0; tso->next_frag_idx = 0; tso->ipv6 = vlan_get_protocol(skb) == htons(ETH_P_IPV6);