Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/567913/?format=api
{ "id": 567913, "url": "http://patchwork.ozlabs.org/api/patches/567913/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160115044156.24270.72533.stgit@localhost.localdomain/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20160115044156.24270.72533.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2016-01-15T04:41:56", "name": "[next,1/3] i40e: Refactor TSO to resolve unwanted behaviors", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "666d2b73e6648e15013ce7dec35c9dbaecd0266e", "submitter": { "id": 67293, "url": "http://patchwork.ozlabs.org/api/people/67293/?format=api", "name": "Alexander Duyck", "email": "aduyck@mirantis.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160115044156.24270.72533.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/567913/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/567913/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ozlabs.org (Postfix) with ESMTP id 576D414032F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Jan 2016 15:42:02 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id CA90F9176A;\n\tFri, 15 Jan 2016 04:42:00 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id I2w8kIhJptWK; Fri, 15 Jan 2016 04:41:59 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9111B9176B;\n\tFri, 15 Jan 2016 04:41:59 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 7CB831BFA5C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 15 Jan 2016 04:41:59 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 77874935C2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 15 Jan 2016 04:41:59 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id MsEGoujMiFVz for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 15 Jan 2016 04:41:58 +0000 (UTC)", "from mail-pf0-f171.google.com (mail-pf0-f171.google.com\n\t[209.85.192.171])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 3CD6E8726A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 15 Jan 2016 04:41:58 +0000 (UTC)", "by mail-pf0-f171.google.com with SMTP id 65so111356689pff.2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 14 Jan 2016 20:41:58 -0800 (PST)", "from localhost.localdomain\n\t(static-50-53-29-36.bvtn.or.frontiernet.net. [50.53.29.36])\n\tby smtp.gmail.com with ESMTPSA id\n\ts13sm10761894pfi.12.2016.01.14.20.41.57\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Jan 2016 20:41:57 -0800 (PST)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mirantis.com header.i=@mirantis.com\n\theader.b=SuzN4Ax9; dkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com;\n\ts=google; \n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-type:content-transfer-encoding;\n\tbh=W+mid3IUvJ2cDnj+gaCN6lgLDCNDv5kG2xKsnMPzq/A=;\n\tb=SuzN4Ax9BFj5cxUAjJWDpnXA2PxC8byzqsN3/fDky6kSHoQ7R5Ex7DGwN+JX5t7D5E\n\tCW8eeRMTMP+NkF1Q/zCATl2mjBZqOxQ4c+ro82DnSNkcE/YsSIBBJe7RxeabwtURlaU8\n\twFo5EittmkkCmXVNFYdnJTPfxN9irYAgmiVpc=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-type\n\t:content-transfer-encoding;\n\tbh=W+mid3IUvJ2cDnj+gaCN6lgLDCNDv5kG2xKsnMPzq/A=;\n\tb=Acg3N+loI2T3fy/PG4bcEnoMJvCIXU0zbsVuPVE12ro+WqFoJvkLGuxU6VHgkgfxZ7\n\td87y1uqrdQsDhDWSZ0mZ0pX5T0HqPZw66qIFwCHqXfVw9L+rWTxmvNgswbDnWRUafmGU\n\tfUzB8gz8ksEQ/mbwMZFXfK2LCoKBNagUFACJyx83uav9zcLUUiRRt/8InKVjcNfFfFAI\n\tPO9IUOu8Yry0JBZG2NlfbAhCmLcp3pVjoXi2o6DOO2D/cY+Xy+qLMYYQ7/CpcROFlu8f\n\tVC5KfGmLrsvZTOKa+uP42YbABjn+DiRatQ64AUYbvdbpFcHE31GCVj9BoNjhM8EsrZM+\n\tNY4A==", "X-Gm-Message-State": "ALoCoQkQ2LxsByI/EOe0AOUUZm5yboaVMflwYgZDgP9X39ovklzkDLFK0gswyDcJP92Kd383ynU8ZMuRv6uBMtkN149s9+xnew==", "X-Received": "by 10.98.68.211 with SMTP id m80mr11904122pfi.117.1452832917911; \n\tThu, 14 Jan 2016 20:41:57 -0800 (PST)", "From": "Alexander Duyck <aduyck@mirantis.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 14 Jan 2016 20:41:56 -0800", "Message-ID": "<20160115044156.24270.72533.stgit@localhost.localdomain>", "In-Reply-To": "<20160115043921.24270.62791.stgit@localhost.localdomain>", "References": "<20160115043921.24270.62791.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [next PATCH 1/3] i40e: Refactor TSO to resolve\n\tunwanted behaviors", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "This patch is meant to be a general clean-up of tso. There were a number\nof spots where redundant actions were being taken in regards to the TSO\nfunction and the checksum function, or in some cases frames were\ntechnically being corrupted with checksums that were never requested.\n\nSo first of this patch goes through and takes all the spots that were\nwriting the outer IP header checksum to zero and moves them all into the\nTSO function. (This includes the spot in IPv6 where this was occurring).\n\nThe second big change I made was to rework the outer checksum functionality\nso that it would be used when requested via GSO instead of just inserting\nit on all of the headers. This way we should be able to control if it is\nenabled or not via the \"udpcsum\" flag when creating a VXLANn tunnel. The\nfunctionality will likely not be needed for non-segmented frames as we will\nbe able to just compute the checksum via local checksum offload.\n\nI also dropped some useless flags from the hw_enc_features. Specifically\nSCTP offload and RX_CSUM don't have any impact on the actual offloads\nprovided. Specifically a tunnel doesn't advertise SCTP support, mainly\nbecause it is a CRC offload and there is no support for doing it via a\nsoftware offload. The RX_CSUM feature doesn't provide any value add due to\nthe fact that it doesn't really do anything for the tunnel. It either\nreceives checksum offloaded frames or not. If it chooses to ignore them is\nentirely up to it.\n\nSigned-off-by: Alexander Duyck <aduyck@mirantis.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 16 ++---\n drivers/net/ethernet/intel/i40e/i40e_txrx.c | 93 ++++++++++++++++-----------\n drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 \n 3 files changed, 62 insertions(+), 48 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 2cfdd85f50fb..c21ad853d72f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -7473,8 +7473,6 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi)\n \t\ttx_ring->dcb_tc = 0;\n \t\tif (vsi->back->flags & I40E_FLAG_WB_ON_ITR_CAPABLE)\n \t\t\ttx_ring->flags = I40E_TXR_FLAGS_WB_ON_ITR;\n-\t\tif (vsi->back->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)\n-\t\t\ttx_ring->flags |= I40E_TXR_FLAGS_OUTER_UDP_CSUM;\n \t\tvsi->tx_rings[i] = tx_ring;\n \n \t\trx_ring = &tx_ring[1];\n@@ -9018,12 +9016,12 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \tnp = netdev_priv(netdev);\n \tnp->vsi = vsi;\n \n-\tnetdev->hw_enc_features |= NETIF_F_IP_CSUM\t |\n-\t\t\t\t NETIF_F_RXCSUM\t |\n-\t\t\t\t NETIF_F_SCTP_CRC\t |\n-\t\t\t\t NETIF_F_GSO_UDP_TUNNEL |\n-\t\t\t\t NETIF_F_GSO_GRE\t |\n-\t\t\t\t NETIF_F_TSO\t\t |\n+\tnetdev->hw_enc_features |= NETIF_F_IP_CSUM\t |\n+\t\t\t\t NETIF_F_TSO\t\t |\n+\t\t\t\t NETIF_F_TSO_ECN\t |\n+\t\t\t\t NETIF_F_GSO_GRE\t |\n+\t\t\t\t NETIF_F_GSO_UDP_TUNNEL |\n+\t\t\t\t NETIF_F_GSO_UDP_TUNNEL_CSUM |\n \t\t\t\t 0;\n \n \tnetdev->features = NETIF_F_SG\t\t |\n@@ -9045,6 +9043,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \n \tif (!(pf->flags & I40E_FLAG_MFP_ENABLED))\n \t\tnetdev->features |= NETIF_F_NTUPLE;\n+\tif (pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)\n+\t\tnetdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;\n \n \t/* copy netdev features into list of user selectable features */\n \tnetdev->hw_features |= netdev->features;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\nindex ca5f0881a5bf..ac2fa7b02e94 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c\n@@ -2214,11 +2214,18 @@ out:\n static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \t\t u8 *hdr_len, u64 *cd_type_cmd_tso_mss)\n {\n-\tu32 cd_cmd, cd_tso_len, cd_mss;\n-\tstruct ipv6hdr *ipv6h;\n-\tstruct tcphdr *tcph;\n-\tstruct iphdr *iph;\n-\tu32 l4len;\n+\tu64 cd_cmd, cd_tso_len, cd_mss;\n+\tunion {\n+\t\tstruct iphdr *v4;\n+\t\tstruct ipv6hdr *v6;\n+\t\tunsigned char *hdr;\n+\t} ip;\n+\tunion {\n+\t\tstruct tcphdr *tcp;\n+\t\tstruct udphdr *udp;\n+\t\tunsigned char *hdr;\n+\t} l4;\n+\tu32 paylen, l4_offset;\n \tint err;\n \n \tif (skb->ip_summed != CHECKSUM_PARTIAL)\n@@ -2231,35 +2238,51 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,\n \tif (err < 0)\n \t\treturn err;\n \n-\tiph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);\n-\tipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb);\n-\n-\tif (iph->version == 4) {\n-\t\ttcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);\n-\t\tiph->tot_len = 0;\n-\t\tiph->check = 0;\n-\t\ttcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,\n-\t\t\t\t\t\t 0, IPPROTO_TCP, 0);\n-\t} else if (ipv6h->version == 6) {\n-\t\ttcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);\n-\t\tipv6h->payload_len = 0;\n-\t\ttcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr,\n-\t\t\t\t\t 0, IPPROTO_TCP, 0);\n+\tip.hdr = skb_network_header(skb);\n+\tl4.hdr = skb_transport_header(skb);\n+\n+\tif (skb->encapsulation) {\n+\t\tif (ip.v4->version == 4) {\n+\t\t\tip.v4->check = 0;\n+\t\t\tip.v4->tot_len = 0;\n+\t\t} else {\n+\t\t\tip.v6->payload_len = 0;\n+\t\t}\n+\n+\t\t/* if we end up needing to do any changes such as update\n+\t\t * the pseudo header checksum on the outer header we\n+\t\t * should do it here.\n+\t\t */\n+\n+\t\tip.hdr = skb_inner_network_header(skb);\n+\t\tl4.hdr = skb_inner_transport_header(skb);\n \t}\n \n-\tl4len = skb->encapsulation ? inner_tcp_hdrlen(skb) : tcp_hdrlen(skb);\n-\t*hdr_len = (skb->encapsulation\n-\t\t ? (skb_inner_transport_header(skb) - skb->data)\n-\t\t : skb_transport_offset(skb)) + l4len;\n+\t/* initialize IP header fields */\n+\tif (ip.v4->version == 4) {\n+\t\tip.v4->check = 0;\n+\t\tip.v4->tot_len = 0;\n+\t} else {\n+\t\tip.v6->payload_len = 0;\n+\t}\n+\n+\t/* determine offset of transport header */\n+\tl4_offset = l4.hdr - skb->data;\n+\n+\t/* remove payload length from checksum */\n+\tpaylen = ntohs(1) * (u16)~(skb->len - l4_offset);\n+\tl4.tcp->check = ~csum_fold((__force __wsum)paylen + l4.tcp->check);\n+\n+\t/* compute length of segmentation header */\n+\t*hdr_len = (l4.tcp->doff * 4) + l4_offset;\n \n \t/* find the field values */\n \tcd_cmd = I40E_TX_CTX_DESC_TSO;\n \tcd_tso_len = skb->len - *hdr_len;\n \tcd_mss = skb_shinfo(skb)->gso_size;\n-\t*cd_type_cmd_tso_mss |= ((u64)cd_cmd << I40E_TXD_CTX_QW1_CMD_SHIFT) |\n-\t\t\t\t((u64)cd_tso_len <<\n-\t\t\t\t I40E_TXD_CTX_QW1_TSO_LEN_SHIFT) |\n-\t\t\t\t((u64)cd_mss << I40E_TXD_CTX_QW1_MSS_SHIFT);\n+\t*cd_type_cmd_tso_mss |= (cd_cmd << I40E_TXD_CTX_QW1_CMD_SHIFT) |\n+\t\t\t\t(cd_tso_len << I40E_TXD_CTX_QW1_TSO_LEN_SHIFT) |\n+\t\t\t\t(cd_mss << I40E_TXD_CTX_QW1_MSS_SHIFT);\n \treturn 1;\n }\n \n@@ -2351,15 +2374,12 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,\n \t\tif (*tx_flags & I40E_TX_FLAGS_IPV4) {\n \t\t\tif (*tx_flags & I40E_TX_FLAGS_TSO) {\n \t\t\t\t*cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV4;\n-\t\t\t\tip_hdr(skb)->check = 0;\n \t\t\t} else {\n \t\t\t\t*cd_tunneling |=\n \t\t\t\t\t I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM;\n \t\t\t}\n \t\t} else if (*tx_flags & I40E_TX_FLAGS_IPV6) {\n \t\t\t*cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6;\n-\t\t\tif (*tx_flags & I40E_TX_FLAGS_TSO)\n-\t\t\t\tip_hdr(skb)->check = 0;\n \t\t}\n \n \t\t/* Now set the ctx descriptor fields */\n@@ -2373,15 +2393,11 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,\n \t\t\t*tx_flags &= ~I40E_TX_FLAGS_IPV4;\n \t\t\t*tx_flags |= I40E_TX_FLAGS_IPV6;\n \t\t}\n-\t\tif ((tx_ring->flags & I40E_TXR_FLAGS_OUTER_UDP_CSUM) &&\n-\t\t (l4_tunnel == I40E_TXD_CTX_UDP_TUNNELING) &&\n-\t\t (*cd_tunneling & I40E_TXD_CTX_QW0_EXT_IP_MASK)) {\n-\t\t\toudph->check = ~csum_tcpudp_magic(oiph->saddr,\n-\t\t\t\t\toiph->daddr,\n-\t\t\t\t\t(skb->len - skb_transport_offset(skb)),\n-\t\t\t\t\tIPPROTO_UDP, 0);\n+\t\t/* indicate if we need to offload outer UDP header */\n+\t\tif ((*tx_flags & I40E_TX_FLAGS_TSO) &&\n+\t\t (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))\n \t\t\t*cd_tunneling |= I40E_TXD_CTX_QW0_L4T_CS_MASK;\n-\t\t}\n+\n \t} else {\n \t\tnetwork_hdr_len = skb_network_header_len(skb);\n \t\tthis_ip_hdr = ip_hdr(skb);\n@@ -2397,7 +2413,6 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,\n \t\t */\n \t\tif (*tx_flags & I40E_TX_FLAGS_TSO) {\n \t\t\t*td_cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM;\n-\t\t\tthis_ip_hdr->check = 0;\n \t\t} else {\n \t\t\t*td_cmd |= I40E_TX_DESC_CMD_IIPT_IPV4;\n \t\t}\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\nindex 1d167b646193..fc77a271aba8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h\n@@ -275,7 +275,6 @@ struct i40e_ring {\n \n \tu16 flags;\n #define I40E_TXR_FLAGS_WB_ON_ITR\tBIT(0)\n-#define I40E_TXR_FLAGS_OUTER_UDP_CSUM\tBIT(1)\n #define I40E_TXR_FLAGS_LAST_XMIT_MORE_SET BIT(2)\n \n \t/* stats structs */\n", "prefixes": [ "next", "1/3" ] }