Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/719919/?format=api
{ "id": 719919, "url": "http://patchwork.ozlabs.org/api/patches/719919/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1485392057-3261-3-git-send-email-sridhar.samudrala@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": "<1485392057-3261-3-git-send-email-sridhar.samudrala@intel.com>", "list_archive_url": null, "date": "2017-01-26T00:54:12", "name": "[next-queue,v5,2/7] i40e: Introduce VF Port Representator(VFPR) netdevs", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "a03550a52294977c7864a73d53732bdbb7aebf57", "submitter": { "id": 65219, "url": "http://patchwork.ozlabs.org/api/people/65219/?format=api", "name": "Samudrala, Sridhar", "email": "sridhar.samudrala@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/1485392057-3261-3-git-send-email-sridhar.samudrala@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/719919/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/719919/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3v83NS3MKNz9sDg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 26 Jan 2017 11:54:48 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 03BBD30DD2;\n\tThu, 26 Jan 2017 00:54:47 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ZTFcFo-TBdDu; Thu, 26 Jan 2017 00:54:39 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 8175F30DE7;\n\tThu, 26 Jan 2017 00:54:34 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id E721F1C04AB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 26 Jan 2017 00:54:30 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E6181890D9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 26 Jan 2017 00:54:30 +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 Fmgbc9uYvLkd for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 26 Jan 2017 00:54:28 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 56315890DD\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 26 Jan 2017 00:54:28 +0000 (UTC)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jan 2017 16:54:27 -0800", "from sri-mi-02.jf.intel.com ([10.166.188.51])\n\tby orsmga002.jf.intel.com with ESMTP; 25 Jan 2017 16:54:27 -0800" ], "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.33,287,1477983600\"; d=\"scan'208\";a=\"35554982\"", "From": "Sridhar Samudrala <sridhar.samudrala@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 25 Jan 2017 16:54:12 -0800", "Message-Id": "<1485392057-3261-3-git-send-email-sridhar.samudrala@intel.com>", "X-Mailer": "git-send-email 2.5.5", "In-Reply-To": "<1485392057-3261-1-git-send-email-sridhar.samudrala@intel.com>", "References": "<1485392057-3261-1-git-send-email-sridhar.samudrala@intel.com>", "Subject": "[Intel-wired-lan] [next-queue v5 PATCH 2/7] i40e: Introduce VF Port\n\tRepresentator(VFPR) netdevs", "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": "VF Port Representator netdevs are created for each VF if the switch mode\nis set to 'switchdev'. These netdevs can be used to control and configure\nVFs from PFs namespace. They enable exposing VF statistics, configure and\nmonitor link state, mtu, filters, fdb/vlan entries etc. of VFs.\nBroadcast filters are not enabled in switchdev mode.\nVFPR netdevs inherit the mac address from the PF.\n\nSample script to create VF port representors\n# rmmod i40e; modprobe i40e\n# devlink dev eswitch set pci/0000:05:00.0 mode switchdev\n# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs\n# ip l show\n297: enp5s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop portid 6805ca2e7268 state DOWN mode DEFAULT group default qlen 1000\n link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff\n vf 0 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off\n vf 1 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off\n299: enp5s0f0-vf0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff\n300: enp5s0f0-vf1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff\n\nSigned-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>\nSigned-off-by: Anjali Singhai <anjali.singhai@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 21 ++-\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 153 ++++++++++++++++++++-\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 14 ++\n 3 files changed, 182 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 699ba1e..e62472f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -11358,13 +11358,32 @@ static int i40e_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)\n static int i40e_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode)\n {\n \tstruct i40e_pf *pf = devlink_priv(devlink);\n-\tint err = 0;\n+\tstruct i40e_vf *vf;\n+\tint i, j, err = 0;\n \n \tif (mode == pf->eswitch_mode)\n \t\tgoto done;\n \n \tswitch (mode) {\n \tcase DEVLINK_ESWITCH_MODE_LEGACY:\n+\t\tfor (i = 0; i < pf->num_alloc_vfs; i++) {\n+\t\t\tvf = &pf->vf[i];\n+\t\t\ti40e_free_vfpr_netdev(vf);\n+\t\t}\n+\t\tpf->eswitch_mode = mode;\n+\t\tbreak;\n+\tcase DEVLINK_ESWITCH_MODE_SWITCHDEV:\n+\t\tfor (i = 0; i < pf->num_alloc_vfs; i++) {\n+\t\t\tvf = &pf->vf[i];\n+\t\t\terr = i40e_alloc_vfpr_netdev(vf, i);\n+\t\t\tif (err) {\n+\t\t\t\tfor (j = 0; j < i; j++) {\n+\t\t\t\t\tvf = &pf->vf[j];\n+\t\t\t\t\ti40e_free_vfpr_netdev(vf);\n+\t\t\t\t}\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\t\t}\n \t\tpf->eswitch_mode = mode;\n \t\tbreak;\n \tdefault:\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 5b08fb9..3d45ef2 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -696,11 +696,15 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)\n \t\t\t\t\t \"Could not add MAC filter %pM for VF %d\\n\",\n \t\t\t\t\tvf->default_lan_addr.addr, vf->vf_id);\n \t\t}\n-\t\teth_broadcast_addr(broadcast);\n-\t\tf = i40e_add_mac_filter(vsi, broadcast);\n-\t\tif (!f)\n-\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t \"Could not allocate VF broadcast filter\\n\");\n+\n+\t\t/* Add VF broadcast filter only in 'legacy' mode */\n+\t\tif (vsi->back->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY) {\n+\t\t\teth_broadcast_addr(broadcast);\n+\t\t\tf = i40e_add_mac_filter(vsi, broadcast);\n+\t\t\tif (!f)\n+\t\t\t\tdev_info(&pf->pdev->dev,\n+\t\t\t\t\t \"Could not allocate VF broadcast filter\\n\");\n+\t\t}\n \t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t\ti40e_write_rx_ctl(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id),\n \t\t\t\t (u32)hena);\n@@ -1018,6 +1022,137 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)\n }\n \n /**\n+ * i40e_vfpr_netdev_open\n+ * @dev: network interface device structure\n+ *\n+ * Called when vfpr netdevice is brought up.\n+ **/\n+static int i40e_vfpr_netdev_open(struct net_device *dev)\n+{\n+\treturn 0;\n+}\n+\n+/**\n+ * i40e_vfpr_netdev_stop\n+ * @dev: network interface device structure\n+ *\n+ * Called when vfpr netdevice is brought down.\n+ **/\n+static int i40e_vfpr_netdev_stop(struct net_device *dev)\n+{\n+\treturn 0;\n+}\n+\n+static const struct net_device_ops i40e_vfpr_netdev_ops = {\n+\t.ndo_open\t\t= i40e_vfpr_netdev_open,\n+\t.ndo_stop\t\t= i40e_vfpr_netdev_stop,\n+};\n+\n+/**\n+ * i40e_update_vf_broadcast_filter\n+ * @vf: pointer to the VF structure\n+ * @enable: boolean flag indicating add/delete\n+ *\n+ * add/delete VFs broadcast filter\n+ **/\n+void i40e_update_vf_broadcast_filter(struct i40e_vf *vf, bool enable)\n+{\n+\tstruct i40e_pf *pf = vf->pf;\n+\tstruct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];\n+\tu8 broadcast[ETH_ALEN];\n+\tint err;\n+\n+\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n+\teth_broadcast_addr(broadcast);\n+\tif (enable)\n+\t\ti40e_add_mac_filter(vsi, broadcast);\n+\telse\n+\t\ti40e_del_mac_filter(vsi, broadcast);\n+\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n+\n+\t/* update broadcast filter */\n+\terr = i40e_sync_vsi_filters(vsi);\n+\tif (err)\n+\t\tdev_err(&pf->pdev->dev, \"Unable to program bcast filter\\n\");\n+}\n+\n+/**\n+ * i40e_alloc_vfpr_netdev\n+ * @vf: pointer to the VF structure\n+ * @vf_num: VF number\n+ *\n+ * Create VF Port representor netdev\n+ **/\n+int i40e_alloc_vfpr_netdev(struct i40e_vf *vf, u16 vf_num)\n+{\n+\tstruct net_device *vfpr_netdev;\n+\tchar netdev_name[IFNAMSIZ];\n+\tstruct i40e_vfpr_netdev_priv *priv;\n+\tstruct i40e_pf *pf = vf->pf;\n+\tstruct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];\n+\tint err;\n+\n+\tsnprintf(netdev_name, IFNAMSIZ, \"%s-vf%d\", vsi->netdev->name, vf_num);\n+\tvfpr_netdev = alloc_netdev(sizeof(struct i40e_vfpr_netdev_priv),\n+\t\t\t\t netdev_name, NET_NAME_UNKNOWN, ether_setup);\n+\tif (!vfpr_netdev) {\n+\t\tdev_err(&pf->pdev->dev, \"alloc_netdev failed for vf:%d\\n\",\n+\t\t\tvf_num);\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tpf->vf[vf_num].vfpr_netdev = vfpr_netdev;\n+\n+\tpriv = netdev_priv(vfpr_netdev);\n+\tpriv->vf = &pf->vf[vf_num];\n+\n+\tvfpr_netdev->netdev_ops = &i40e_vfpr_netdev_ops;\n+\teth_hw_addr_inherit(vfpr_netdev, vsi->netdev);\n+\n+\tnetif_carrier_off(vfpr_netdev);\n+\tnetif_tx_disable(vfpr_netdev);\n+\n+\terr = register_netdev(vfpr_netdev);\n+\tif (err) {\n+\t\tdev_err(&pf->pdev->dev, \"register_netdev failed for vf: %s\\n\",\n+\t\t\tvf->vfpr_netdev->name);\n+\t\tfree_netdev(vfpr_netdev);\n+\t\treturn err;\n+\t}\n+\n+\tdev_info(&pf->pdev->dev, \"VF Port representor(%s) created for VF %d\\n\",\n+\t\t vf->vfpr_netdev->name, vf_num);\n+\n+\t/* Delete broadcast filter for VF */\n+\ti40e_update_vf_broadcast_filter(vf, false);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * i40e_free_vfpr_netdev\n+ * @vf: pointer to the VF structure\n+ *\n+ * Free VF Port representor netdev\n+ **/\n+void i40e_free_vfpr_netdev(struct i40e_vf *vf)\n+{\n+\tstruct i40e_pf *pf = vf->pf;\n+\n+\tif (!vf->vfpr_netdev)\n+\t\treturn;\n+\n+\tdev_info(&pf->pdev->dev, \"Freeing VF Port representor(%s)\\n\",\n+\t\t vf->vfpr_netdev->name);\n+\n+\tunregister_netdev(vf->vfpr_netdev);\n+\tfree_netdev(vf->vfpr_netdev);\n+\n+\t/* Add broadcast filter to VF */\n+\ti40e_update_vf_broadcast_filter(vf, true);\n+}\n+\n+/**\n * i40e_free_vfs\n * @pf: pointer to the PF structure\n *\n@@ -1058,6 +1193,9 @@ void i40e_free_vfs(struct i40e_pf *pf)\n \t\t\ti40e_free_vf_res(&pf->vf[i]);\n \t\t/* disable qp mappings */\n \t\ti40e_disable_vf_mappings(&pf->vf[i]);\n+\n+\t\tif (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV)\n+\t\t\ti40e_free_vfpr_netdev(&pf->vf[i]);\n \t}\n \n \tkfree(pf->vf);\n@@ -1125,6 +1263,11 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)\n \t\t/* VF resources get allocated during reset */\n \t\ti40e_reset_vf(&vfs[i], false);\n \n+\t\tif (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) {\n+\t\t\tret = i40e_alloc_vfpr_netdev(&vfs[i], i);\n+\t\t\tif (ret)\n+\t\t\t\tgoto err_alloc;\n+\t\t}\n \t}\n \tpf->num_alloc_vfs = num_alloc_vfs;\n \ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 4012d06..25ce93c 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -72,10 +72,21 @@ enum i40e_vf_capabilities {\n \tI40E_VIRTCHNL_VF_CAP_IWARP,\n };\n \n+/* VF Port representator netdev private structure */\n+struct i40e_vfpr_netdev_priv {\n+\tstruct i40e_vf *vf;\n+};\n+\n /* VF information structure */\n struct i40e_vf {\n \tstruct i40e_pf *pf;\n \n+\t/* VF Port representator netdev that allows control and configuration\n+\t * of VFs from the host. Enables returning VF stats, configuring link\n+\t * state, mtu, fdb/vlans etc.\n+\t */\n+\tstruct net_device *vfpr_netdev;\n+\n \t/* VF id in the PF space */\n \ts16 vf_id;\n \t/* all VF vsis connect to the same parent */\n@@ -142,4 +153,7 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);\n void i40e_vc_notify_link_state(struct i40e_pf *pf);\n void i40e_vc_notify_reset(struct i40e_pf *pf);\n \n+int i40e_alloc_vfpr_netdev(struct i40e_vf *vf, u16 vf_num);\n+void i40e_free_vfpr_netdev(struct i40e_vf *vf);\n+\n #endif /* _I40E_VIRTCHNL_PF_H_ */\n", "prefixes": [ "next-queue", "v5", "2/7" ] }