Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/566061/?format=api
{ "id": 566061, "url": "http://patchwork.ozlabs.org/api/patches/566061/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160111175415.4101.60735.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": "<20160111175415.4101.60735.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2016-01-11T17:54:15", "name": "[next,4/4] igbvf: Add support for generic Tx checksums", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "3ba61acc1da1e6a8bb22389c653d3d6774242586", "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/20160111175415.4101.60735.stgit@localhost.localdomain/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/566061/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/566061/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 A3A6A1402F0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Jan 2016 04:54:21 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 53EA487463;\n\tMon, 11 Jan 2016 17:54:20 +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 rFFfNUmQ+hYH; Mon, 11 Jan 2016 17:54:19 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3F25986D24;\n\tMon, 11 Jan 2016 17:54:19 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 48C2F1C1E4E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 11 Jan 2016 17:54:19 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 44FDA84E3A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 11 Jan 2016 17:54:19 +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 jZ9igtOZKEmz for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 11 Jan 2016 17:54:18 +0000 (UTC)", "from mail-pf0-f171.google.com (mail-pf0-f171.google.com\n\t[209.85.192.171])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 7FA78868B6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 11 Jan 2016 17:54:18 +0000 (UTC)", "by mail-pf0-f171.google.com with SMTP id q63so49460334pfb.1\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 11 Jan 2016 09:54:18 -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\tb84sm24745326pfj.25.2016.01.11.09.54.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 11 Jan 2016 09:54:17 -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=Ju6m7QgP; 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=KX0Pb/7IePVQdoFfAjr4J4A9KhRaj3jZMJq9IhTgjyo=;\n\tb=Ju6m7QgPAIw39bJkVv41LYfwQ2N3ztdn/2Nq+GmJ8Hhmcr6HFk4XXiphKdLqqgZhft\n\tWNRs6THzuOl+SbcQGYi0Hva2LWYK7tCEe61jEe3rtbFSFDic6DfvL3RF4PQVxC2slRkQ\n\tJLR1WeQCoxLGhOK/8SKWCKOw4INXQLeJWJhuo=", "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=KX0Pb/7IePVQdoFfAjr4J4A9KhRaj3jZMJq9IhTgjyo=;\n\tb=HaqrcewOGR0FlB0XJP9kq1DIFfIsd2hpSvxEz7bHYKlRibC4fd64D4dsb7I2xCTtCe\n\t+ZOdvtpeLezTxabstVCwm2SjOnjhLlZ+yST6C4N0JOwVj5aKI+8Z5kZwCgnKD3IliAhd\n\tcVWmZZGlef/+xpGhtr7GTKK4JRQlnyUvn4S/1nmgBMOyhPL1Uuph9cgPYAgr1ghJmT8g\n\ttWsb8G103IbZhbpgHz+ouRzDVFCKBhmj1StHO8e6Yji45EjgFvsJsz7Kob5V6pvdswR8\n\tjFhxSn0An9e5XVzVqof1/iit0Sywjbkd8RHaSSbe+MP7ogOHO1UhXjnPEistVmcFxfEG\n\tAgcA==", "X-Gm-Message-State": "ALoCoQnF9H38vMMek5Kl45ze9bwicswGC3ULtv4KuOGolHt8VYNMr/7r6XlHywcQhMSckhvtS4ZDLh8p15CDk1MSnDQTrL1M8g==", "X-Received": "by 10.98.42.74 with SMTP id q71mr10358888pfq.18.1452534858223;\n\tMon, 11 Jan 2016 09:54:18 -0800 (PST)", "From": "Alexander Duyck <aduyck@mirantis.com>", "To": "intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com", "Date": "Mon, 11 Jan 2016 09:54:15 -0800", "Message-ID": "<20160111175415.4101.60735.stgit@localhost.localdomain>", "In-Reply-To": "<20160111173724.4101.35798.stgit@localhost.localdomain>", "References": "<20160111173724.4101.35798.stgit@localhost.localdomain>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Cc": "tom@herbertland.com, netdev@vger.kernel.org", "Subject": "[Intel-wired-lan] [next PATCH 4/4] igbvf: Add support for generic\n\tTx 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 insert\nVLAN 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..ee6a75ee916c 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 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", "4/4" ] }