From patchwork Thu Nov 12 15:19:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Cree X-Patchwork-Id: 11900491 X-Patchwork-Delegate: kuba@kernel.org 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 32D65C2D0A3 for ; Thu, 12 Nov 2020 15:19:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB80822240 for ; Thu, 12 Nov 2020 15:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728543AbgKLPTi (ORCPT ); Thu, 12 Nov 2020 10:19:38 -0500 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:55228 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgKLPTh (ORCPT ); Thu, 12 Nov 2020 10:19:37 -0500 Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.144]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 9A070200D5; Thu, 12 Nov 2020 15:19:36 +0000 (UTC) Received: from us4-mdac16-41.at1.mdlocal (unknown [10.110.48.12]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 9796E800A9; Thu, 12 Nov 2020 15:19:36 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.49.108]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 2E87240075; Thu, 12 Nov 2020 15:19:36 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E9C31140074; Thu, 12 Nov 2020 15:19:35 +0000 (UTC) Received: from [10.17.20.203] (10.17.20.203) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Nov 2020 15:19:30 +0000 From: Edward Cree Subject: [PATCH net-next 1/3] sfc: extend bitfield macros to 19 fields To: , CC: , References: Message-ID: <5ce9986a-4c5c-9ffd-e83d-e6782ff370ba@solarflare.com> Date: Thu, 12 Nov 2020 15:19:26 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Originating-IP: [10.17.20.203] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25782.003 X-TM-AS-Result: No-0.095100-8.000000-10 X-TMASE-MatchedRID: C1DXOoX+qqn2up/bgDqTK7sHVDDM5xAP1JP9NndNOkUHZBaLwEXlKCzy bVqWyY2N0gDCkQzZ7yFil9NyRvcTnEkjllSXrjtQOX/V8P8ail1yZ8zcONpAscRB0bsfrpPInxM yeYT53Rk9FnBw45/tLOBI91hkK7qyEXSCqqRvu5X6beaNfw18XQves2r39oXJkz8BDdGAzndnxJ Bhjh8ytVZjGZPLD5W4vxF9leMhxrkaEFYXAylB9SUSM5mwacGkICQpusqRi2ejpeaEV8oRRMPIN hwTXBeZ X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-0.095100-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25782.003 X-MDID: 1605194376-ZEjdgpaTKfz3 X-PPE-DISP: 1605194376;ZEjdgpaTKfz3 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Our TSO descriptors got even more fussy. Signed-off-by: Edward Cree --- drivers/net/ethernet/sfc/bitfield.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/sfc/bitfield.h b/drivers/net/ethernet/sfc/bitfield.h index 64731eb5dd56..1f981dfe4bdc 100644 --- a/drivers/net/ethernet/sfc/bitfield.h +++ b/drivers/net/ethernet/sfc/bitfield.h @@ -289,7 +289,9 @@ typedef union efx_oword { field14, value14, \ field15, value15, \ field16, value16, \ - field17, value17) \ + field17, value17, \ + field18, value18, \ + field19, value19) \ (EFX_INSERT_FIELD_NATIVE((min), (max), field1, (value1)) | \ EFX_INSERT_FIELD_NATIVE((min), (max), field2, (value2)) | \ EFX_INSERT_FIELD_NATIVE((min), (max), field3, (value3)) | \ @@ -306,7 +308,9 @@ typedef union efx_oword { EFX_INSERT_FIELD_NATIVE((min), (max), field14, (value14)) | \ EFX_INSERT_FIELD_NATIVE((min), (max), field15, (value15)) | \ EFX_INSERT_FIELD_NATIVE((min), (max), field16, (value16)) | \ - EFX_INSERT_FIELD_NATIVE((min), (max), field17, (value17))) + EFX_INSERT_FIELD_NATIVE((min), (max), field17, (value17)) | \ + EFX_INSERT_FIELD_NATIVE((min), (max), field18, (value18)) | \ + EFX_INSERT_FIELD_NATIVE((min), (max), field19, (value19))) #define EFX_INSERT_FIELDS64(...) \ cpu_to_le64(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__)) @@ -348,7 +352,11 @@ typedef union efx_oword { #endif /* Populate an octword field with various numbers of arguments */ -#define EFX_POPULATE_OWORD_17 EFX_POPULATE_OWORD +#define EFX_POPULATE_OWORD_19 EFX_POPULATE_OWORD +#define EFX_POPULATE_OWORD_18(oword, ...) \ + EFX_POPULATE_OWORD_19(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) +#define EFX_POPULATE_OWORD_17(oword, ...) \ + EFX_POPULATE_OWORD_18(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_OWORD_16(oword, ...) \ EFX_POPULATE_OWORD_17(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_OWORD_15(oword, ...) \ @@ -391,7 +399,11 @@ typedef union efx_oword { EFX_DWORD_3, 0xffffffff) /* Populate a quadword field with various numbers of arguments */ -#define EFX_POPULATE_QWORD_17 EFX_POPULATE_QWORD +#define EFX_POPULATE_QWORD_19 EFX_POPULATE_QWORD +#define EFX_POPULATE_QWORD_18(qword, ...) \ + EFX_POPULATE_QWORD_19(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) +#define EFX_POPULATE_QWORD_17(qword, ...) \ + EFX_POPULATE_QWORD_18(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_QWORD_16(qword, ...) \ EFX_POPULATE_QWORD_17(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_QWORD_15(qword, ...) \ @@ -432,7 +444,11 @@ typedef union efx_oword { EFX_DWORD_1, 0xffffffff) /* Populate a dword field with various numbers of arguments */ -#define EFX_POPULATE_DWORD_17 EFX_POPULATE_DWORD +#define EFX_POPULATE_DWORD_19 EFX_POPULATE_DWORD +#define EFX_POPULATE_DWORD_18(dword, ...) \ + EFX_POPULATE_DWORD_19(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) +#define EFX_POPULATE_DWORD_17(dword, ...) \ + EFX_POPULATE_DWORD_18(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_DWORD_16(dword, ...) \ EFX_POPULATE_DWORD_17(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) #define EFX_POPULATE_DWORD_15(dword, ...) \ From patchwork Thu Nov 12 15:19:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Cree X-Patchwork-Id: 11900489 X-Patchwork-Delegate: kuba@kernel.org 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 D3062C2D0A3 for ; Thu, 12 Nov 2020 15:20:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 781BD22240 for ; Thu, 12 Nov 2020 15:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728617AbgKLPT7 (ORCPT ); Thu, 12 Nov 2020 10:19:59 -0500 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:55928 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727932AbgKLPT7 (ORCPT ); Thu, 12 Nov 2020 10:19:59 -0500 Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.150]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id B0568200FE; Thu, 12 Nov 2020 15:19:57 +0000 (UTC) Received: from us4-mdac16-24.at1.mdlocal (unknown [10.110.49.206]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id AE4EA800AF; Thu, 12 Nov 2020 15:19:57 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.49.108]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 17D7B10007F; Thu, 12 Nov 2020 15:19:57 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id D4877140055; Thu, 12 Nov 2020 15:19:56 +0000 (UTC) Received: from [10.17.20.203] (10.17.20.203) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Nov 2020 15:19:51 +0000 From: Edward Cree Subject: [PATCH net-next 2/3] sfc: correctly support non-partial GSO_UDP_TUNNEL_CSUM on EF100 To: , CC: , References: Message-ID: <6c770e62-231c-6c98-d850-820a9c9a1012@solarflare.com> Date: Thu, 12 Nov 2020 15:19:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Originating-IP: [10.17.20.203] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25782.003 X-TM-AS-Result: No-0.493000-8.000000-10 X-TMASE-MatchedRID: TWnYCMK5KzdCeO9z35rMg0V4CvmC4hgmZAGtCJE23YjzB9ACjDXPutti DkJwpre6tipQQRHpDAAX0wellvm416H2g9syPs888Kg68su2wyE/pOSL72dTfwdkFovAReUoaUX s6FguVy0jW5FWKYjOGB238RECSCTtHzpIYp97uNYgCPGiZqtI8D4H4hoqLeJJH1bhq4z+yfRAvt BOrQ7+YI1gywLb9VwiIDTeqMjs2DvjN5FxHmqL+T9eH8dNy75y5kzxLgNhSillEnpqwB4ckaPFj JEFr+olA9Mriq0CDAg9wJeM2pSaRVgXepbcl7r7gJwNekNcqRsVtunJa77J297aYbIsxaDLix0s f028gLsx0/5NDE6dKrHmc46TQnW7qCSWvg10XvDUavu8ykObvWfwm7RvQdj7McKpXuu/1jVAMwW 4rY/0WO2hZq8RbsdETdnyMokJ1HTiaosWHm9+bH7cGd19dSFd X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.493000-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25782.003 X-MDID: 1605194397-lvf_h0UvuEJN X-PPE-DISP: 1605194397;lvf_h0UvuEJN Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org By asking the HW for the correct edits, we can make UDP tunnel TSO work without needing GSO_PARTIAL. So don't specify it in our netdev->gso_partial_features. However, retain GSO_PARTIAL support, as this will be used for other protocols later. Signed-off-by: Edward Cree --- drivers/net/ethernet/sfc/ef100_nic.c | 1 - drivers/net/ethernet/sfc/ef100_tx.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index cd93c5ffd45c..05d22220228a 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -190,7 +190,6 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx) net_dev->features |= tso; net_dev->hw_features |= tso; net_dev->hw_enc_features |= tso; - net_dev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM; } efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS); diff --git a/drivers/net/ethernet/sfc/ef100_tx.c b/drivers/net/ethernet/sfc/ef100_tx.c index ad0ad9bad423..a9e045c54a79 100644 --- a/drivers/net/ethernet/sfc/ef100_tx.c +++ b/drivers/net/ethernet/sfc/ef100_tx.c @@ -196,6 +196,7 @@ static void ef100_make_tso_desc(struct efx_nic *efx, bool encap = skb->encapsulation; u16 vlan_enable = 0; struct tcphdr *tcp; + bool outer_csum; u32 paylen; if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID) @@ -216,19 +217,21 @@ static void ef100_make_tso_desc(struct efx_nic *efx, tcp_offset = skb_transport_offset(skb); outer_ip_offset = outer_l4_offset = 0; } + outer_csum = skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM; /* subtract TCP payload length from inner checksum */ tcp = (void *)skb->data + tcp_offset; paylen = skb->len - tcp_offset; csum_replace_by_diff(&tcp->check, (__force __wsum)htonl(paylen)); - EFX_POPULATE_OWORD_17(*txd, + EFX_POPULATE_OWORD_19(*txd, ESF_GZ_TX_DESC_TYPE, ESE_GZ_TX_DESC_TYPE_TSO, ESF_GZ_TX_TSO_MSS, mss, ESF_GZ_TX_TSO_HDR_NUM_SEGS, 1, ESF_GZ_TX_TSO_PAYLOAD_NUM_SEGS, payload_segs, ESF_GZ_TX_TSO_HDR_LEN_W, buffer->len >> 1, ESF_GZ_TX_TSO_PAYLOAD_LEN, len, + ESF_GZ_TX_TSO_CSO_OUTER_L4, outer_csum, ESF_GZ_TX_TSO_CSO_INNER_L4, 1, ESF_GZ_TX_TSO_INNER_L3_OFF_W, ip_offset >> 1, ESF_GZ_TX_TSO_INNER_L4_OFF_W, tcp_offset >> 1, @@ -237,6 +240,7 @@ static void ef100_make_tso_desc(struct efx_nic *efx, ESF_GZ_TX_TSO_OUTER_L3_OFF_W, outer_ip_offset >> 1, ESF_GZ_TX_TSO_OUTER_L4_OFF_W, outer_l4_offset >> 1, ESF_GZ_TX_TSO_ED_OUTER_UDP_LEN, encap && !gso_partial, + ESF_GZ_TX_TSO_ED_OUTER_IP_LEN, encap && !gso_partial, ESF_GZ_TX_TSO_ED_OUTER_IP4_ID, encap ? mangleid : ESE_GZ_TX_DESC_IP4_ID_NO_OP, ESF_GZ_TX_TSO_VLAN_INSERT_EN, vlan_enable, From patchwork Thu Nov 12 15:20:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Cree X-Patchwork-Id: 11900493 X-Patchwork-Delegate: kuba@kernel.org 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 75674C2D0A3 for ; Thu, 12 Nov 2020 15:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 122A52224A for ; Thu, 12 Nov 2020 15:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728619AbgKLPUR (ORCPT ); Thu, 12 Nov 2020 10:20:17 -0500 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:60032 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728258AbgKLPUQ (ORCPT ); Thu, 12 Nov 2020 10:20:16 -0500 Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.150]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id B4BCE201B9; Thu, 12 Nov 2020 15:20:15 +0000 (UTC) Received: from us4-mdac16-63.at1.mdlocal (unknown [10.110.50.156]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id B2DA2800AF; Thu, 12 Nov 2020 15:20:15 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.49.107]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 1AA5E10007E; Thu, 12 Nov 2020 15:20:15 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id D7834280080; Thu, 12 Nov 2020 15:20:14 +0000 (UTC) Received: from [10.17.20.203] (10.17.20.203) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Nov 2020 15:20:09 +0000 From: Edward Cree Subject: [PATCH net-next 3/3] sfc: support GRE TSO on EF100 To: , CC: , References: Message-ID: <07a77fe6-2418-d13a-9ef6-ea292ec87883@solarflare.com> Date: Thu, 12 Nov 2020 15:20:05 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Originating-IP: [10.17.20.203] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25782.003 X-TM-AS-Result: No-3.008600-8.000000-10 X-TMASE-MatchedRID: 6q+DmWmERNooS/tMLUVY9eIfK/Jd5eHmprzcyrz2L10WhfQgHJ/xHkCQ j+h+9wPkdNLu0Uc2RiUN25tj8sME0qH2g9syPs888Kg68su2wyE/pOSL72dTfwdkFovAReUoaUX s6FguVy2/bQ5VOF8E64K2BS2ryBmc4pT+ud9Ye/oHtOpEBhWiFswx7VbZgGmK+G875WvUoRDfel djYKxB4ht8UJiMz9H8UGVEq8q5z4rloCs7pAMiMyT9vTe4FHdQrqNUh44b3oMo6/BioTjbkKPFj JEFr+olA9Mriq0CDAg9wJeM2pSaRSdET58jp62SKW+Wt2vD66Z9dB9Zj7b9xH7joChQiie03WM5 Codml8QigxlR1qZWV8/URmGOc4QqNVkooC8+ZQ1nyD9HuSCiNRX4hCOS9JJEMcKpXuu/1jVAMwW 4rY/0WO2hZq8RbsdETdnyMokJ1HRF/CeP64tXnA== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.008600-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25782.003 X-MDID: 1605194415-y01JdQjz-G2B X-PPE-DISP: 1605194415;y01JdQjz-G2B Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We can treat SKB_GSO_GRE almost exactly the same as UDP tunnels, except that we don't want to edit the outer UDP len (as there isn't one). For SKB_GSO_GRE_CSUM, we have to use GSO_PARTIAL as the device doesn't support offload of non-UDP outer L4 checksums. Signed-off-by: Edward Cree --- drivers/net/ethernet/sfc/ef100_nic.c | 7 ++++++- drivers/net/ethernet/sfc/ef100_tx.c | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 05d22220228a..518268ce2064 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -185,11 +185,16 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx) if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) { struct net_device *net_dev = efx->net_dev; netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL | - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM; + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM; net_dev->features |= tso; net_dev->hw_features |= tso; net_dev->hw_enc_features |= tso; + /* EF100 HW can only offload outer checksums if they are UDP, + * so for GRE_CSUM we have to use GSO_PARTIAL. + */ + net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; } efx->num_mac_stats = MCDI_WORD(outbuf, GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS); diff --git a/drivers/net/ethernet/sfc/ef100_tx.c b/drivers/net/ethernet/sfc/ef100_tx.c index a9e045c54a79..26ef51d6b542 100644 --- a/drivers/net/ethernet/sfc/ef100_tx.c +++ b/drivers/net/ethernet/sfc/ef100_tx.c @@ -194,6 +194,7 @@ static void ef100_make_tso_desc(struct efx_nic *efx, u16 vlan_tci = skb_vlan_tag_get(skb); u32 mss = skb_shinfo(skb)->gso_size; bool encap = skb->encapsulation; + bool udp_encap = false; u16 vlan_enable = 0; struct tcphdr *tcp; bool outer_csum; @@ -212,6 +213,9 @@ static void ef100_make_tso_desc(struct efx_nic *efx, outer_l4_offset = skb_transport_offset(skb); ip_offset = skb_inner_network_offset(skb); tcp_offset = skb_inner_transport_offset(skb); + if (skb_shinfo(skb)->gso_type & + (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP_TUNNEL_CSUM)) + udp_encap = true; } else { ip_offset = skb_network_offset(skb); tcp_offset = skb_transport_offset(skb); @@ -239,7 +243,7 @@ static void ef100_make_tso_desc(struct efx_nic *efx, ESF_GZ_TX_TSO_ED_INNER_IP_LEN, 1, ESF_GZ_TX_TSO_OUTER_L3_OFF_W, outer_ip_offset >> 1, ESF_GZ_TX_TSO_OUTER_L4_OFF_W, outer_l4_offset >> 1, - ESF_GZ_TX_TSO_ED_OUTER_UDP_LEN, encap && !gso_partial, + ESF_GZ_TX_TSO_ED_OUTER_UDP_LEN, udp_encap && !gso_partial, ESF_GZ_TX_TSO_ED_OUTER_IP_LEN, encap && !gso_partial, ESF_GZ_TX_TSO_ED_OUTER_IP4_ID, encap ? mangleid : ESE_GZ_TX_DESC_IP4_ID_NO_OP,