Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1208831/?format=api
{ "id": 1208831, "url": "http://patchwork.ozlabs.org/api/patches/1208831/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191212111307.33566-10-anthony.l.nguyen@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": "<20191212111307.33566-10-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2019-12-12T11:13:02", "name": "[S35,10/15] ice: Enable ip link show on the PF to display VF unicast MAC(s)", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9f327fcd03e3ad2ef75f7eef4d18c40b7f46041f", "submitter": { "id": 68875, "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api", "name": "Tony Nguyen", "email": "anthony.l.nguyen@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/20191212111307.33566-10-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 148167, "url": "http://patchwork.ozlabs.org/api/series/148167/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=148167", "date": "2019-12-12T11:13:03", "name": "[S35,01/15] ice: Support UDP segmentation offload", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/148167/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1208831/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1208831/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@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" ], "Authentication-Results": [ "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.136;\n\thelo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 47Yklt5TM5z9sPL\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 13 Dec 2019 06:44:58 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3EB5824F06;\n\tThu, 12 Dec 2019 19:44:57 +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 kgYFEW60e4nT; Thu, 12 Dec 2019 19:44:51 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id F3F2425296;\n\tThu, 12 Dec 2019 19:44:47 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id D2EF11BF340\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:42 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id B13A4883ED\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:42 +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 I4czD97MX1rD for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:37 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 85DFB8843E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Dec 2019 19:44:37 +0000 (UTC)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Dec 2019 11:44:36 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga001.jf.intel.com with ESMTP; 12 Dec 2019 11:44:34 -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-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.69,306,1571727600\"; d=\"scan'208\";a=\"296698857\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Thu, 12 Dec 2019 03:13:02 -0800", "Message-Id": "<20191212111307.33566-10-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "References": "<20191212111307.33566-1-anthony.l.nguyen@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S35 10/15] ice: Enable ip link show on the\n\tPF to display VF unicast MAC(s)", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "From: Brett Creeley <brett.creeley@intel.com>\n\nCurrently when there are SR-IOV VF(s) and the user does \"ip link show <pf\ninterface>\" the VF unicast MAC addresses all show 00:00:00:00:00:00\nif the unicast MAC was set via VIRTCHNL (i.e. not administratively set\nby the host PF).\n\nThis is misleading to the host administrator. Fix this by setting the\nVF's dflt_lan_addr.addr when the VF's unicast MAC address is\nconfigured via VIRTCHNL. There are a couple cases where we don't allow\nthe dflt_lan_addr.addr field to be written. First, If the VF's\npf_set_mac field is true and the VF is not trusted, then we don't allow\nthe dflt_lan_addr.addr to be modified. Second, if the\ndflt_lan_addr.addr has already been set (i.e. via VIRTCHNL).\n\nAlso a small refactor was done to separate the flow for add and delete\nMAC addresses in order to simplify the logic for error conditions\nand set/clear the VF's dflt_lan_addr.addr field.\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\n---\n .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 199 +++++++++---------\n 1 file changed, 99 insertions(+), 100 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex c1708eb7ee75..c4f825650f30 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -34,37 +34,6 @@ static int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf)\n \treturn 0;\n }\n \n-/**\n- * ice_err_to_virt err - translate errors for VF return code\n- * @ice_err: error return code\n- */\n-static enum virtchnl_status_code ice_err_to_virt_err(enum ice_status ice_err)\n-{\n-\tswitch (ice_err) {\n-\tcase ICE_SUCCESS:\n-\t\treturn VIRTCHNL_STATUS_SUCCESS;\n-\tcase ICE_ERR_BAD_PTR:\n-\tcase ICE_ERR_INVAL_SIZE:\n-\tcase ICE_ERR_DEVICE_NOT_SUPPORTED:\n-\tcase ICE_ERR_PARAM:\n-\tcase ICE_ERR_CFG:\n-\t\treturn VIRTCHNL_STATUS_ERR_PARAM;\n-\tcase ICE_ERR_NO_MEMORY:\n-\t\treturn VIRTCHNL_STATUS_ERR_NO_MEMORY;\n-\tcase ICE_ERR_NOT_READY:\n-\tcase ICE_ERR_RESET_FAILED:\n-\tcase ICE_ERR_FW_API_VER:\n-\tcase ICE_ERR_AQ_ERROR:\n-\tcase ICE_ERR_AQ_TIMEOUT:\n-\tcase ICE_ERR_AQ_FULL:\n-\tcase ICE_ERR_AQ_NO_WORK:\n-\tcase ICE_ERR_AQ_EMPTY:\n-\t\treturn VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;\n-\tdefault:\n-\t\treturn VIRTCHNL_STATUS_ERR_NOT_SUPPORTED;\n-\t}\n-}\n-\n /**\n * ice_vc_vf_broadcast - Broadcast a message to all VFs on PF\n * @pf: pointer to the PF structure\n@@ -2458,6 +2427,83 @@ static bool ice_can_vf_change_mac(struct ice_vf *vf)\n \treturn true;\n }\n \n+/**\n+ * ice_vc_add_mac_addr - attempt to add the MAC address passed in\n+ * @vf: pointer to the VF info\n+ * @vsi: pointer to the VF's VSI\n+ * @mac_addr: MAC address to add\n+ */\n+static int\n+ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, u8 *mac_addr)\n+{\n+\tstruct device *dev = ice_pf_to_dev(vf->pf);\n+\tenum ice_status status;\n+\n+\t/* default unicast MAC already added */\n+\tif (ether_addr_equal(mac_addr, vf->dflt_lan_addr.addr))\n+\t\treturn 0;\n+\n+\tif (is_unicast_ether_addr(mac_addr) && !ice_can_vf_change_mac(vf)) {\n+\t\tdev_err(dev, \"VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\\n\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, mac_addr, true);\n+\tif (status == ICE_ERR_ALREADY_EXISTS) {\n+\t\tdev_err(dev, \"MAC %pM already exists for VF %d\\n\", mac_addr,\n+\t\t\tvf->vf_id);\n+\t\treturn -EEXIST;\n+\t} else if (status) {\n+\t\tdev_err(dev, \"Failed to add MAC %pM for VF %d\\n, error %d\\n\",\n+\t\t\tmac_addr, vf->vf_id, status);\n+\t\treturn -EIO;\n+\t}\n+\n+\t/* only set dflt_lan_addr once */\n+\tif (is_zero_ether_addr(vf->dflt_lan_addr.addr) &&\n+\t is_unicast_ether_addr(mac_addr))\n+\t\tether_addr_copy(vf->dflt_lan_addr.addr, mac_addr);\n+\n+\tvf->num_mac++;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_vc_del_mac_addr - attempt to delete the MAC address passed in\n+ * @vf: pointer to the VF info\n+ * @vsi: pointer to the VF's VSI\n+ * @mac_addr: MAC address to delete\n+ */\n+static int\n+ice_vc_del_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, u8 *mac_addr)\n+{\n+\tstruct device *dev = ice_pf_to_dev(vf->pf);\n+\tenum ice_status status;\n+\n+\tif (!ice_can_vf_change_mac(vf) &&\n+\t ether_addr_equal(mac_addr, vf->dflt_lan_addr.addr))\n+\t\treturn 0;\n+\n+\tstatus = ice_vsi_cfg_mac_fltr(vsi, mac_addr, false);\n+\tif (status == ICE_ERR_DOES_NOT_EXIST) {\n+\t\tdev_err(dev, \"MAC %pM does not exist for VF %d\\n\", mac_addr,\n+\t\t\tvf->vf_id);\n+\t\treturn -ENOENT;\n+\t} else if (status) {\n+\t\tdev_err(dev, \"Failed to delete MAC %pM for VF %d, error %d\\n\",\n+\t\t\tmac_addr, vf->vf_id, status);\n+\t\treturn -EIO;\n+\t}\n+\n+\tif (ether_addr_equal(mac_addr, vf->dflt_lan_addr.addr))\n+\t\teth_zero_addr(vf->dflt_lan_addr.addr);\n+\n+\tvf->num_mac--;\n+\n+\treturn 0;\n+}\n+\n /**\n * ice_vc_handle_mac_addr_msg\n * @vf: pointer to the VF info\n@@ -2469,23 +2515,23 @@ static bool ice_can_vf_change_mac(struct ice_vf *vf)\n static int\n ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)\n {\n+\tint (*ice_vc_cfg_mac)\n+\t\t(struct ice_vf *vf, struct ice_vsi *vsi, u8 *mac_addr);\n \tenum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;\n \tstruct virtchnl_ether_addr_list *al =\n \t (struct virtchnl_ether_addr_list *)msg;\n \tstruct ice_pf *pf = vf->pf;\n \tenum virtchnl_ops vc_op;\n-\tenum ice_status status;\n \tstruct ice_vsi *vsi;\n-\tstruct device *dev;\n-\tint mac_count = 0;\n \tint i;\n \n-\tdev = ice_pf_to_dev(pf);\n-\n-\tif (set)\n+\tif (set) {\n \t\tvc_op = VIRTCHNL_OP_ADD_ETH_ADDR;\n-\telse\n+\t\tice_vc_cfg_mac = ice_vc_add_mac_addr;\n+\t} else {\n \t\tvc_op = VIRTCHNL_OP_DEL_ETH_ADDR;\n+\t\tice_vc_cfg_mac = ice_vc_del_mac_addr;\n+\t}\n \n \tif (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states) ||\n \t !ice_vc_isvalid_vsi_id(vf, al->vsi_id)) {\n@@ -2493,14 +2539,15 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)\n \t\tgoto handle_mac_exit;\n \t}\n \n+\t/* If this VF is not privileged, then we can't add more than a\n+\t * limited number of addresses. Check to make sure that the\n+\t * additions do not push us over the limit.\n+\t */\n \tif (set && !ice_is_vf_trusted(vf) &&\n \t (vf->num_mac + al->num_elements) > ICE_MAX_MACADDR_PER_VF) {\n-\t\tdev_err(dev,\n+\t\tdev_err(ice_pf_to_dev(pf),\n \t\t\t\"Can't add more MAC addresses, because VF-%d is not trusted, switch the VF to trusted mode in order to add more functionalities\\n\",\n \t\t\tvf->vf_id);\n-\t\t/* There is no need to let VF know about not being trusted\n-\t\t * to add more MAC addr, so we can just return success message.\n-\t\t */\n \t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n \t\tgoto handle_mac_exit;\n \t}\n@@ -2512,70 +2559,22 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)\n \t}\n \n \tfor (i = 0; i < al->num_elements; i++) {\n-\t\tu8 *maddr = al->list[i].addr;\n+\t\tu8 *mac_addr = al->list[i].addr;\n+\t\tint result;\n \n-\t\tif (ether_addr_equal(maddr, vf->dflt_lan_addr.addr) ||\n-\t\t is_broadcast_ether_addr(maddr)) {\n-\t\t\tif (set) {\n-\t\t\t\t/* VF is trying to add filters that the PF\n-\t\t\t\t * already added. Just continue.\n-\t\t\t\t */\n-\t\t\t\tdev_info(dev,\n-\t\t\t\t\t \"MAC %pM already set for VF %d\\n\",\n-\t\t\t\t\t maddr, vf->vf_id);\n-\t\t\t\tcontinue;\n-\t\t\t} else {\n-\t\t\t\t/* VF can't remove dflt_lan_addr/bcast MAC */\n-\t\t\t\tdev_err(dev,\n-\t\t\t\t\t\"VF can't remove default MAC address or MAC %pM programmed by PF for VF %d\\n\",\n-\t\t\t\t\tmaddr, vf->vf_id);\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t}\n-\n-\t\t/* check for the invalid cases and bail if necessary */\n-\t\tif (is_zero_ether_addr(maddr)) {\n-\t\t\tdev_err(dev,\n-\t\t\t\t\"invalid MAC %pM provided for VF %d\\n\",\n-\t\t\t\tmaddr, vf->vf_id);\n-\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n-\t\t\tgoto handle_mac_exit;\n-\t\t}\n-\n-\t\tif (is_unicast_ether_addr(maddr) &&\n-\t\t !ice_can_vf_change_mac(vf)) {\n-\t\t\tdev_err(dev,\n-\t\t\t\t\"can't change unicast MAC for untrusted VF %d\\n\",\n-\t\t\t\tvf->vf_id);\n-\t\t\tv_ret = VIRTCHNL_STATUS_ERR_PARAM;\n-\t\t\tgoto handle_mac_exit;\n-\t\t}\n+\t\tif (is_broadcast_ether_addr(mac_addr) ||\n+\t\t is_zero_ether_addr(mac_addr))\n+\t\t\tcontinue;\n \n-\t\t/* program the updated filter list */\n-\t\tstatus = ice_vsi_cfg_mac_fltr(vsi, maddr, set);\n-\t\tif (status == ICE_ERR_DOES_NOT_EXIST ||\n-\t\t status == ICE_ERR_ALREADY_EXISTS) {\n-\t\t\tdev_info(dev,\n-\t\t\t\t \"can't %s MAC filters %pM for VF %d, error %d\\n\",\n-\t\t\t\t set ? \"add\" : \"remove\", maddr, vf->vf_id,\n-\t\t\t\t status);\n-\t\t} else if (status) {\n-\t\t\tdev_err(dev,\n-\t\t\t\t\"can't %s MAC filters for VF %d, error %d\\n\",\n-\t\t\t\tset ? \"add\" : \"remove\", vf->vf_id, status);\n-\t\t\tv_ret = ice_err_to_virt_err(status);\n+\t\tresult = ice_vc_cfg_mac(vf, vsi, mac_addr);\n+\t\tif (result == -EEXIST || result == -ENOENT) {\n+\t\t\tcontinue;\n+\t\t} else if (result) {\n+\t\t\tv_ret = VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR;\n \t\t\tgoto handle_mac_exit;\n \t\t}\n-\n-\t\tmac_count++;\n \t}\n \n-\t/* Track number of MAC filters programmed for the VF VSI */\n-\tif (set)\n-\t\tvf->num_mac += mac_count;\n-\telse\n-\t\tvf->num_mac -= mac_count;\n-\n handle_mac_exit:\n \t/* send the response to the VF */\n \treturn ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0);\n", "prefixes": [ "S35", "10/15" ] }