Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/639896/?format=api
{ "id": 639896, "url": "http://patchwork.ozlabs.org/api/patches/639896/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160623205403.20327-2-jacob.e.keller@intel.com/", "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": "<20160623205403.20327-2-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2016-06-23T20:54:02", "name": "[1/2] fm10k: rework vxlan_port offload before adding geneve support", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0573733ef3929129ebfa09c246c861499eddd01b", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@intel.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/20160623205403.20327-2-jacob.e.keller@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/639896/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/639896/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\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rbDGX6yFCz9sBg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 24 Jun 2016 06:54:12 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7752B8D517;\n\tThu, 23 Jun 2016 20:54:11 +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 FoTGPem4-2XJ; Thu, 23 Jun 2016 20:54:09 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 8F2AD8C9D0;\n\tThu, 23 Jun 2016 20:54:09 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 1E95F1C2D29\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Jun 2016 20:54:07 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 1A87AC0BE4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Jun 2016 20:54:07 +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 DNguoqHPikhY for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Jun 2016 20:54:05 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B4833C0BA8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 23 Jun 2016 20:54:05 +0000 (UTC)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga101.fm.intel.com with ESMTP; 23 Jun 2016 13:54:05 -0700", "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([134.134.3.116])\n\tby fmsmga004.fm.intel.com with ESMTP; 23 Jun 2016 13:54:05 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.26,518,1459839600\"; d=\"scan'208\";a=\"127512093\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>", "Date": "Thu, 23 Jun 2016 13:54:02 -0700", "Message-Id": "<20160623205403.20327-2-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.9.0.rc1.405.g81f467e", "In-Reply-To": "<20160623205403.20327-1-jacob.e.keller@intel.com>", "References": "<20160623205403.20327-1-jacob.e.keller@intel.com>", "Subject": "[Intel-wired-lan] [PATCH 1/2] fm10k: rework vxlan_port offload\n\tbefore adding geneve support", "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>", "MIME-Version": "1.0", "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": "In preparation for adding Geneve Rx offload support, refactor the\ncurrent VXLAN offload flow to be a bit more generic so that it will be\neasier to add the new Geneve code. The fm10k hardware supports one VXLAN\nand one Geneve tunnel, so we will eventually treat the VXLAN and Geneve\ntunnels identically. To this end, factor out the code that handles the\ncurrent list so that we can use the generic flow for both tunnels in the\nnext patch.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/fm10k/fm10k.h | 6 +-\n drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 +-\n drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 167 +++++++++++++-----------\n 3 files changed, 94 insertions(+), 83 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h\nindex e9850697be04..209268a14712 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k.h\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h\n@@ -240,9 +240,7 @@ struct fm10k_iov_data {\n \tstruct fm10k_vf_info\tvf_info[0];\n };\n \n-#define fm10k_vxlan_port_for_each(vp, intfc) \\\n-\tlist_for_each_entry(vp, &(intfc)->vxlan_port, list)\n-struct fm10k_vxlan_port {\n+struct fm10k_udp_port {\n \tstruct list_head\tlist;\n \tsa_family_t\t\tsa_family;\n \t__be16\t\t\tport;\n@@ -335,7 +333,7 @@ struct fm10k_intfc {\n \tu32 reta[FM10K_RETA_SIZE];\n \tu32 rssrk[FM10K_RSSRK_SIZE];\n \n-\t/* VXLAN port tracking information */\n+\t/* UDP encapsulation port tracking information */\n \tstruct list_head vxlan_port;\n \n #ifdef CONFIG_DEBUG_FS\ndiff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c\nindex c2c7f2ef2152..199884305c7a 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c\n@@ -651,11 +651,11 @@ static int fm10k_clean_rx_irq(struct fm10k_q_vector *q_vector,\n static struct ethhdr *fm10k_port_is_vxlan(struct sk_buff *skb)\n {\n \tstruct fm10k_intfc *interface = netdev_priv(skb->dev);\n-\tstruct fm10k_vxlan_port *vxlan_port;\n+\tstruct fm10k_udp_port *vxlan_port;\n \n \t/* we can only offload a vxlan if we recognize it as such */\n \tvxlan_port = list_first_entry_or_null(&interface->vxlan_port,\n-\t\t\t\t\t struct fm10k_vxlan_port, list);\n+\t\t\t\t\t struct fm10k_udp_port, list);\n \n \tif (!vxlan_port)\n \t\treturn NULL;\ndiff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\nindex 8ce918f87a05..411933b02712 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c\n@@ -384,133 +384,147 @@ static void fm10k_request_glort_range(struct fm10k_intfc *interface)\n }\n \n /**\n- * fm10k_del_vxlan_port_all\n+ * fm10k_free_udp_port_info\n * @interface: board private structure\n *\n * This function frees the entire vxlan_port list\n **/\n-static void fm10k_del_vxlan_port_all(struct fm10k_intfc *interface)\n+static void fm10k_free_udp_port_info(struct fm10k_intfc *interface)\n {\n-\tstruct fm10k_vxlan_port *vxlan_port;\n+\tstruct fm10k_udp_port *port;\n \n-\t/* flush all entries from list */\n-\tvxlan_port = list_first_entry_or_null(&interface->vxlan_port,\n-\t\t\t\t\t struct fm10k_vxlan_port, list);\n-\twhile (vxlan_port) {\n-\t\tlist_del(&vxlan_port->list);\n-\t\tkfree(vxlan_port);\n-\t\tvxlan_port = list_first_entry_or_null(&interface->vxlan_port,\n-\t\t\t\t\t\t struct fm10k_vxlan_port,\n-\t\t\t\t\t\t list);\n+\t/* flush all entries from vxlan list */\n+\tport = list_first_entry_or_null(&interface->vxlan_port,\n+\t\t\t\t\tstruct fm10k_udp_port, list);\n+\twhile (port) {\n+\t\tlist_del(&port->list);\n+\t\tkfree(port);\n+\t\tport = list_first_entry_or_null(&interface->vxlan_port,\n+\t\t\t\t\t\tstruct fm10k_udp_port,\n+\t\t\t\t\t\tlist);\n \t}\n }\n \n /**\n- * fm10k_restore_vxlan_port\n+ * fm10k_restore_udp_port_info\n * @interface: board private structure\n *\n- * This function restores the value in the tunnel_cfg register after reset\n+ * This function restores the value in the tunnel_cfg register(s) after reset\n **/\n-static void fm10k_restore_vxlan_port(struct fm10k_intfc *interface)\n+static void fm10k_restore_udp_port_info(struct fm10k_intfc *interface)\n {\n \tstruct fm10k_hw *hw = &interface->hw;\n-\tstruct fm10k_vxlan_port *vxlan_port;\n+\tstruct fm10k_udp_port *port;\n \n \t/* only the PF supports configuring tunnels */\n \tif (hw->mac.type != fm10k_mac_pf)\n \t\treturn;\n \n-\tvxlan_port = list_first_entry_or_null(&interface->vxlan_port,\n-\t\t\t\t\t struct fm10k_vxlan_port, list);\n+\tport = list_first_entry_or_null(&interface->vxlan_port,\n+\t\t\t\t\tstruct fm10k_udp_port, list);\n \n \t/* restore tunnel configuration register */\n \tfm10k_write_reg(hw, FM10K_TUNNEL_CFG,\n-\t\t\t(vxlan_port ? ntohs(vxlan_port->port) : 0) |\n+\t\t\t(port ? ntohs(port->port) : 0) |\n \t\t\t(ETH_P_TEB << FM10K_TUNNEL_CFG_NVGRE_SHIFT));\n }\n \n+static struct fm10k_udp_port *\n+fm10k_remove_tunnel_port(struct list_head *ports,\n+\t\t\t struct udp_tunnel_info *ti)\n+{\n+\tstruct fm10k_udp_port *port;\n+\n+\tlist_for_each_entry(port, ports, list) {\n+\t\tif ((port->port == ti->port) &&\n+\t\t (port->sa_family == ti->sa_family)) {\n+\t\t\tlist_del(&port->list);\n+\t\t\treturn port;\n+\t\t}\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+static void fm10k_insert_tunnel_port(struct list_head *ports,\n+\t\t\t\t struct udp_tunnel_info *ti)\n+{\n+\tstruct fm10k_udp_port *port;\n+\n+\t/* remove existing port entry from the list so that the newest items\n+\t * are always at the tail of the list.\n+\t */\n+\tport = fm10k_remove_tunnel_port(ports, ti);\n+\tif (!port) {\n+\t\tport = kmalloc(sizeof(*port), GFP_ATOMIC);\n+\t\tif (!port)\n+\t\t\treturn;\n+\t\tport->port = ti->port;\n+\t\tport->sa_family = ti->sa_family;\n+\t}\n+\n+\tlist_add_tail(&port->list, ports);\n+}\n+\n /**\n- * fm10k_add_vxlan_port\n+ * fm10k_udp_tunnel_add\n * @netdev: network interface device structure\n- * @sa_family: Address family of new port\n- * @port: port number used for VXLAN\n- * @type: Enumerated value specifying udp encapsulation type\n+ * @ti: Tunnel endpoint information\n *\n- * This function is called when a new VXLAN interface has added a new port\n- * number to the range that is currently in use for VXLAN. The new port\n- * number is always added to the tail so that the port number list should\n- * match the order in which the ports were allocated. The head of the list\n- * is always used as the VXLAN port number for offloads.\n+ * This function is called when a new UDP tunnel port has been added.\n+ * Currently we only support VXLAN and only one port will actually be\n+ * offloaded due to hardware restrictions.\n **/\n-static void fm10k_add_vxlan_port(struct net_device *dev,\n+static void fm10k_udp_tunnel_add(struct net_device *dev,\n \t\t\t\t struct udp_tunnel_info *ti)\n {\n \tstruct fm10k_intfc *interface = netdev_priv(dev);\n-\tstruct fm10k_vxlan_port *vxlan_port;\n \n-\tif (ti->type != UDP_TUNNEL_TYPE_VXLAN)\n-\t\treturn;\n \t/* only the PF supports configuring tunnels */\n \tif (interface->hw.mac.type != fm10k_mac_pf)\n \t\treturn;\n \n-\t/* existing ports are pulled out so our new entry is always last */\n-\tfm10k_vxlan_port_for_each(vxlan_port, interface) {\n-\t\tif ((vxlan_port->port == ti->port) &&\n-\t\t (vxlan_port->sa_family == ti->sa_family)) {\n-\t\t\tlist_del(&vxlan_port->list);\n-\t\t\tgoto insert_tail;\n-\t\t}\n+\tswitch (ti->type) {\n+\tcase UDP_TUNNEL_TYPE_VXLAN:\n+\t\tfm10k_insert_tunnel_port(&interface->vxlan_port, ti);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn;\n \t}\n \n-\t/* allocate memory to track ports */\n-\tvxlan_port = kmalloc(sizeof(*vxlan_port), GFP_ATOMIC);\n-\tif (!vxlan_port)\n-\t\treturn;\n-\tvxlan_port->port = ti->port;\n-\tvxlan_port->sa_family = ti->sa_family;\n-\n-insert_tail:\n-\t/* add new port value to list */\n-\tlist_add_tail(&vxlan_port->list, &interface->vxlan_port);\n-\n-\tfm10k_restore_vxlan_port(interface);\n+\tfm10k_restore_udp_port_info(interface);\n }\n \n /**\n- * fm10k_del_vxlan_port\n+ * fm10k_udp_tunnel_del\n * @netdev: network interface device structure\n- * @sa_family: Address family of freed port\n- * @port: port number used for VXLAN\n- * @type: Enumerated value specifying udp encapsulation type\n+ * @ti: Tunnel end point information\n *\n- * This function is called when a new VXLAN interface has freed a port\n- * number from the range that is currently in use for VXLAN. The freed\n- * port is removed from the list and the new head is used to determine\n- * the port number for offloads.\n+ * This function is called when a new UDP tunnel port is deleted. The freed\n+ * port will be removed from the list, then we reprogram the offloaded port\n+ * based on the head of the list.\n **/\n-static void fm10k_del_vxlan_port(struct net_device *dev,\n+static void fm10k_udp_tunnel_del(struct net_device *dev,\n \t\t\t\t struct udp_tunnel_info *ti)\n {\n \tstruct fm10k_intfc *interface = netdev_priv(dev);\n-\tstruct fm10k_vxlan_port *vxlan_port;\n+\tstruct fm10k_udp_port *port = NULL;\n \n-\tif (ti->type != UDP_TUNNEL_TYPE_VXLAN)\n-\t\treturn;\n \tif (interface->hw.mac.type != fm10k_mac_pf)\n \t\treturn;\n \n-\t/* find the port in the list and free it */\n-\tfm10k_vxlan_port_for_each(vxlan_port, interface) {\n-\t\tif ((vxlan_port->port == ti->port) &&\n-\t\t (vxlan_port->sa_family == ti->sa_family)) {\n-\t\t\tlist_del(&vxlan_port->list);\n-\t\t\tkfree(vxlan_port);\n-\t\t\tbreak;\n-\t\t}\n+\tswitch (ti->type) {\n+\tcase UDP_TUNNEL_TYPE_VXLAN:\n+\t\tport = fm10k_remove_tunnel_port(&interface->vxlan_port, ti);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn;\n \t}\n \n-\tfm10k_restore_vxlan_port(interface);\n+\t/* if we did remove a port we need to free its memory */\n+\tkfree(port);\n+\n+\tfm10k_restore_udp_port_info(interface);\n }\n \n /**\n@@ -559,7 +573,6 @@ int fm10k_open(struct net_device *netdev)\n \tif (err)\n \t\tgoto err_set_queues;\n \n-\t/* update VXLAN port configuration */\n \tudp_tunnel_get_rx_info(netdev);\n \n \tfm10k_up(interface);\n@@ -595,7 +608,7 @@ int fm10k_close(struct net_device *netdev)\n \n \tfm10k_qv_free_irq(interface);\n \n-\tfm10k_del_vxlan_port_all(interface);\n+\tfm10k_free_udp_port_info(interface);\n \n \tfm10k_free_all_tx_resources(interface);\n \tfm10k_free_all_rx_resources(interface);\n@@ -1059,7 +1072,7 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)\n \tinterface->xcast_mode = xcast_mode;\n \n \t/* Restore tunnel configuration */\n-\tfm10k_restore_vxlan_port(interface);\n+\tfm10k_restore_udp_port_info(interface);\n }\n \n void fm10k_reset_rx_state(struct fm10k_intfc *interface)\n@@ -1379,8 +1392,8 @@ static const struct net_device_ops fm10k_netdev_ops = {\n \t.ndo_set_vf_vlan\t= fm10k_ndo_set_vf_vlan,\n \t.ndo_set_vf_rate\t= fm10k_ndo_set_vf_bw,\n \t.ndo_get_vf_config\t= fm10k_ndo_get_vf_config,\n-\t.ndo_udp_tunnel_add\t= fm10k_add_vxlan_port,\n-\t.ndo_udp_tunnel_del\t= fm10k_del_vxlan_port,\n+\t.ndo_udp_tunnel_add\t= fm10k_udp_tunnel_add,\n+\t.ndo_udp_tunnel_del\t= fm10k_udp_tunnel_del,\n \t.ndo_dfwd_add_station\t= fm10k_dfwd_add_station,\n \t.ndo_dfwd_del_station\t= fm10k_dfwd_del_station,\n #ifdef CONFIG_NET_POLL_CONTROLLER\n", "prefixes": [ "1/2" ] }