Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/566996/?format=api
{ "id": 566996, "url": "http://patchwork.ozlabs.org/api/patches/566996/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160113153130.4527.9429.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": "<20160113153130.4527.9429.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2016-01-13T15:31:30", "name": "[next,v2,4/4] igbvf: Add support for generic Tx checksums", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a5ab2dbb2d9d86a791e95561ee2a7dd23b7be222", "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/20160113153130.4527.9429.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/566996/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/566996/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 296CA140307\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Jan 2016 02:31:35 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 773B286F13;\n\tWed, 13 Jan 2016 15:31:34 +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 dOpLnIBYHguv; Wed, 13 Jan 2016 15:31:33 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B76E786DB5;\n\tWed, 13 Jan 2016 15:31:33 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 698691C0F8E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 15:31:32 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 643FE8B14A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 15:31:32 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id DdCMoa04IB3b for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 15:31:31 +0000 (UTC)", "from mail-pa0-f53.google.com (mail-pa0-f53.google.com\n\t[209.85.220.53])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 8CDE48B109\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 15:31:31 +0000 (UTC)", "by mail-pa0-f53.google.com with SMTP id cy9so360093284pac.0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 07:31:31 -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\tr26sm3464927pfb.21.2016.01.13.07.31.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 13 Jan 2016 07:31:30 -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=cpFRjU1O; 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=jwCOh2A03QoYt8MgKqfC+/1KI3ut6gwCttEKrw0ghmk=;\n\tb=cpFRjU1OH2CZ5z63WVjgA/+KQ88k88yE38zycg0ZH/G3LR+udl1O2IWX5VlNSAzigw\n\tqbR9W0t1pyDzM6hsXobydSnbeSNZ332+8EAb1PsYQO3+b7d/JKNEPR0moLKap+AzoQxi\n\tsJDSWW0tdjnZARJvluvXkHofiesWSGb/WxmsI=", "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=jwCOh2A03QoYt8MgKqfC+/1KI3ut6gwCttEKrw0ghmk=;\n\tb=YYoygVPtqT27jRveqUMbzqJb1mH/wQL/YD8BST277DXTZJSINfEJiT1d02EjBTALe1\n\tjnsBGujImkGed6X96hm3AvS24J53Dngjfp+gffV/jukemAt1A/p73lfTOMqhcRVQr0us\n\tfJ2UXMr9Ap83PKDgNudqTVe8NEKJVAlXQI681b/hOUUzfRjqXH7DAROIZb6ioAJ+uxjk\n\t7uywHwQKcHzqvViHXkBzJCuxJ+6b/CMqiJ8OHUrcN20tFUmy2tudekxzfXFrgAkr5/NW\n\tv8mEPZVycrPkCw/4Vndz1Q3WmF1Xj0chx/5DDMdyrnwatTJf18ji4Id0J6f1e/mnTBKO\n\t7siA==", "X-Gm-Message-State": "ALoCoQkXmXO0seEsT5CHfU82f7rKs69EcHZDT/65Xplfjv3eD2grA86zbGVGylwjiQG/EoCdhfERzU24fkbTuATnsDuDRYryHg==", "X-Received": "by 10.67.3.134 with SMTP id bw6mr33581786pad.11.1452699091145;\n\tWed, 13 Jan 2016 07:31:31 -0800 (PST)", "From": "Alexander Duyck <aduyck@mirantis.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 13 Jan 2016 07:31:30 -0800", "Message-ID": "<20160113153130.4527.9429.stgit@localhost.localdomain>", "In-Reply-To": "<20160113153001.4527.91152.stgit@localhost.localdomain>", "References": "<20160113153001.4527.91152.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [next PATCH v2 4/4] igbvf: Add support for\n\tgeneric Tx checksums", "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 adds support for generic Tx checksums to the igbvf driver. It\nturns out this is actually pretty easy after going over the datasheet as we\nwere doing a number of steps we didn't need to.\n\nIn order to perform a Tx checksum for an L4 header we need to fill in the\nfollowing fields in the Tx descriptor:\n MACLEN (maximum of 127), retrieved from:\n\t\tskb_network_offset()\n IPLEN (maximum of 511), retrieved from:\n\t\tskb_checksum_start_offset() - skb_network_offset()\n TUCMD.L4T indicates offset and if checksum or crc32c, based on:\n\t\tskb->csum_offset\n\nThe added advantage to doing this is that we can support inner checksum\noffloads for tunnels and MPLS while still being able to transparently\ninsert VLAN tags.\n\nI also took the opportunity to clean-up many of the feature flag\nconfiguration bits to make them a bit more consistent between drivers. In\nthe case of the VF drivers this meant adding support for SCTP CRCs, and\ninner checksum offloads for MPLS and various tunnel types.\n\nSigned-off-by: Alexander Duyck <aduyck@mirantis.com>\n---\n drivers/net/ethernet/intel/igbvf/netdev.c | 142 +++++++++++++++++------------\n drivers/net/ethernet/intel/igbvf/vf.h | 1 \n 2 files changed, 82 insertions(+), 61 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c\nindex 297af801f051..aa3486556630 100644\n--- a/drivers/net/ethernet/intel/igbvf/netdev.c\n+++ b/drivers/net/ethernet/intel/igbvf/netdev.c\n@@ -43,6 +43,7 @@\n #include <linux/ethtool.h>\n #include <linux/if_vlan.h>\n #include <linux/prefetch.h>\n+#include <linux/sctp.h>\n \n #include \"igbvf.h\"\n \n@@ -1908,6 +1909,31 @@ static void igbvf_watchdog_task(struct work_struct *work)\n #define IGBVF_TX_FLAGS_VLAN_MASK\t0xffff0000\n #define IGBVF_TX_FLAGS_VLAN_SHIFT\t16\n \n+static void igbvf_tx_ctxtdesc(struct igbvf_ring *tx_ring, u32 vlan_macip_lens,\n+\t\t\t u32 type_tucmd, u32 mss_l4len_idx)\n+{\n+\tstruct e1000_adv_tx_context_desc *context_desc;\n+\tstruct igbvf_buffer *buffer_info;\n+\tu16 i = tx_ring->next_to_use;\n+\n+\tcontext_desc = IGBVF_TX_CTXTDESC_ADV(*tx_ring, i);\n+\tbuffer_info = &tx_ring->buffer_info[i];\n+\n+\ti++;\n+\ttx_ring->next_to_use = (i < tx_ring->count) ? i : 0;\n+\n+\t/* set bits to identify this as an advanced context descriptor */\n+\ttype_tucmd |= E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT;\n+\n+\tcontext_desc->vlan_macip_lens\t= cpu_to_le32(vlan_macip_lens);\n+\tcontext_desc->seqnum_seed\t= 0;\n+\tcontext_desc->type_tucmd_mlhl\t= cpu_to_le32(type_tucmd);\n+\tcontext_desc->mss_l4len_idx\t= cpu_to_le32(mss_l4len_idx);\n+\n+\tbuffer_info->time_stamp = jiffies;\n+\tbuffer_info->dma = 0;\n+}\n+\n static int igbvf_tso(struct igbvf_adapter *adapter,\n \t\t struct igbvf_ring *tx_ring,\n \t\t struct sk_buff *skb, u32 tx_flags, u8 *hdr_len,\n@@ -1987,65 +2013,56 @@ static int igbvf_tso(struct igbvf_adapter *adapter,\n \treturn true;\n }\n \n-static inline bool igbvf_tx_csum(struct igbvf_adapter *adapter,\n-\t\t\t\t struct igbvf_ring *tx_ring,\n-\t\t\t\t struct sk_buff *skb, u32 tx_flags,\n-\t\t\t\t __be16 protocol)\n+static inline bool igbvf_ipv6_csum_is_sctp(struct sk_buff *skb)\n {\n-\tstruct e1000_adv_tx_context_desc *context_desc;\n-\tunsigned int i;\n-\tstruct igbvf_buffer *buffer_info;\n-\tu32 info = 0, tu_cmd = 0;\n-\n-\tif ((skb->ip_summed == CHECKSUM_PARTIAL) ||\n-\t (tx_flags & IGBVF_TX_FLAGS_VLAN)) {\n-\t\ti = tx_ring->next_to_use;\n-\t\tbuffer_info = &tx_ring->buffer_info[i];\n-\t\tcontext_desc = IGBVF_TX_CTXTDESC_ADV(*tx_ring, i);\n+\tunsigned int offset = 0;\n \n-\t\tif (tx_flags & IGBVF_TX_FLAGS_VLAN)\n-\t\t\tinfo |= (tx_flags & IGBVF_TX_FLAGS_VLAN_MASK);\n+\tipv6_find_hdr(skb, &offset, IPPROTO_SCTP, NULL, NULL);\n \n-\t\tinfo |= (skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT);\n-\t\tif (skb->ip_summed == CHECKSUM_PARTIAL)\n-\t\t\tinfo |= (skb_transport_header(skb) -\n-\t\t\t\t skb_network_header(skb));\n+\treturn offset == skb_checksum_start_offset(skb);\n+}\n \n-\t\tcontext_desc->vlan_macip_lens = cpu_to_le32(info);\n+static bool igbvf_tx_csum(struct igbvf_ring *tx_ring, struct sk_buff *skb,\n+\t\t\t u32 tx_flags, __be16 protocol)\n+{\n+\tu32 vlan_macip_lens = 0;\n+\tu32 type_tucmd = 0;\n \n-\t\ttu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);\n+\tif (skb->ip_summed != CHECKSUM_PARTIAL) {\n+csum_failed:\n+\t\tif (!(tx_flags & IGBVF_TX_FLAGS_VLAN))\n+\t\t\treturn false;\n+\t\tgoto no_csum;\n+\t}\n \n-\t\tif (skb->ip_summed == CHECKSUM_PARTIAL) {\n-\t\t\tswitch (protocol) {\n-\t\t\tcase htons(ETH_P_IP):\n-\t\t\t\ttu_cmd |= E1000_ADVTXD_TUCMD_IPV4;\n-\t\t\t\tif (ip_hdr(skb)->protocol == IPPROTO_TCP)\n-\t\t\t\t\ttu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;\n-\t\t\t\tbreak;\n-\t\t\tcase htons(ETH_P_IPV6):\n-\t\t\t\tif (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)\n-\t\t\t\t\ttu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;\n-\t\t\t\tbreak;\n-\t\t\tdefault:\n-\t\t\t\tbreak;\n-\t\t\t}\n+\tswitch (skb->csum_offset) {\n+\tcase offsetof(struct tcphdr, check):\n+\t\ttype_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;\n+\t\t/* fall through */\n+\tcase offsetof(struct udphdr, check):\n+\t\tbreak;\n+\tcase offsetof(struct sctphdr, checksum):\n+\t\t/* validate that this is actually an SCTP request */\n+\t\tif (((protocol == htons(ETH_P_IP)) &&\n+\t\t (ip_hdr(skb)->protocol == IPPROTO_SCTP)) ||\n+\t\t ((protocol == htons(ETH_P_IPV6)) &&\n+\t\t igbvf_ipv6_csum_is_sctp(skb))) {\n+\t\t\ttype_tucmd = E1000_ADVTXD_TUCMD_L4T_SCTP;\n+\t\t\tbreak;\n \t\t}\n-\n-\t\tcontext_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);\n-\t\tcontext_desc->seqnum_seed = 0;\n-\t\tcontext_desc->mss_l4len_idx = 0;\n-\n-\t\tbuffer_info->time_stamp = jiffies;\n-\t\tbuffer_info->dma = 0;\n-\t\ti++;\n-\t\tif (i == tx_ring->count)\n-\t\t\ti = 0;\n-\t\ttx_ring->next_to_use = i;\n-\n-\t\treturn true;\n+\tdefault:\n+\t\tskb_checksum_help(skb);\n+\t\tgoto csum_failed;\n \t}\n \n-\treturn false;\n+\tvlan_macip_lens = skb_checksum_start_offset(skb) -\n+\t\t\t skb_network_offset(skb);\n+no_csum:\n+\tvlan_macip_lens |= skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT;\n+\tvlan_macip_lens |= tx_flags & IGBVF_TX_FLAGS_VLAN_MASK;\n+\n+\tigbvf_tx_ctxtdesc(tx_ring, vlan_macip_lens, type_tucmd, 0);\n+\treturn true;\n }\n \n static int igbvf_maybe_stop_tx(struct net_device *netdev, int size)\n@@ -2264,7 +2281,7 @@ static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb,\n \n \tif (tso)\n \t\ttx_flags |= IGBVF_TX_FLAGS_TSO;\n-\telse if (igbvf_tx_csum(adapter, tx_ring, skb, tx_flags, protocol) &&\n+\telse if (igbvf_tx_csum(tx_ring, skb, tx_flags, protocol) &&\n \t\t (skb->ip_summed == CHECKSUM_PARTIAL))\n \t\ttx_flags |= IGBVF_TX_FLAGS_CSUM;\n \n@@ -2717,11 +2734,11 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tadapter->bd_number = cards_found++;\n \n \tnetdev->hw_features = NETIF_F_SG |\n-\t\t\t NETIF_F_IP_CSUM |\n-\t\t\t NETIF_F_IPV6_CSUM |\n-\t\t\t NETIF_F_TSO |\n-\t\t\t NETIF_F_TSO6 |\n-\t\t\t NETIF_F_RXCSUM;\n+\t\t\t NETIF_F_TSO |\n+\t\t\t NETIF_F_TSO6 |\n+\t\t\t NETIF_F_RXCSUM |\n+\t\t\t NETIF_F_HW_CSUM |\n+\t\t\t NETIF_F_SCTP_CRC;\n \n \tnetdev->features = netdev->hw_features |\n \t\t\t NETIF_F_HW_VLAN_CTAG_TX |\n@@ -2731,11 +2748,14 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tif (pci_using_dac)\n \t\tnetdev->features |= NETIF_F_HIGHDMA;\n \n-\tnetdev->vlan_features |= NETIF_F_TSO;\n-\tnetdev->vlan_features |= NETIF_F_TSO6;\n-\tnetdev->vlan_features |= NETIF_F_IP_CSUM;\n-\tnetdev->vlan_features |= NETIF_F_IPV6_CSUM;\n-\tnetdev->vlan_features |= NETIF_F_SG;\n+\tnetdev->vlan_features |= NETIF_F_SG |\n+\t\t\t\t NETIF_F_TSO |\n+\t\t\t\t NETIF_F_TSO6 |\n+\t\t\t\t NETIF_F_HW_CSUM |\n+\t\t\t\t NETIF_F_SCTP_CRC;\n+\n+\tnetdev->mpls_features |= NETIF_F_HW_CSUM;\n+\tnetdev->hw_enc_features |= NETIF_F_HW_CSUM;\n \n \t/*reset the controller to put the device in a known good state */\n \terr = hw->mac.ops.reset_hw(hw);\ndiff --git a/drivers/net/ethernet/intel/igbvf/vf.h b/drivers/net/ethernet/intel/igbvf/vf.h\nindex 0f1eca639f68..f00a41d9a1ca 100644\n--- a/drivers/net/ethernet/intel/igbvf/vf.h\n+++ b/drivers/net/ethernet/intel/igbvf/vf.h\n@@ -126,6 +126,7 @@ struct e1000_adv_tx_context_desc {\n #define E1000_ADVTXD_MACLEN_SHIFT\t9 /* Adv ctxt desc mac len shift */\n #define E1000_ADVTXD_TUCMD_IPV4\t\t0x00000400 /* IP Packet Type: 1=IPv4 */\n #define E1000_ADVTXD_TUCMD_L4T_TCP\t0x00000800 /* L4 Packet TYPE of TCP */\n+#define E1000_ADVTXD_TUCMD_L4T_SCTP\t0x00001000 /* L4 packet TYPE of SCTP */\n #define E1000_ADVTXD_L4LEN_SHIFT\t8 /* Adv ctxt L4LEN shift */\n #define E1000_ADVTXD_MSS_SHIFT\t\t16 /* Adv ctxt MSS shift */\n \n", "prefixes": [ "next", "v2", "4/4" ] }