Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/692501/?format=api
{ "id": 692501, "url": "http://patchwork.ozlabs.org/api/patches/692501/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1478639119-14656-7-git-send-email-bimmy.pujari@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": "<1478639119-14656-7-git-send-email-bimmy.pujari@intel.com>", "list_archive_url": null, "date": "2016-11-08T21:05:10", "name": "[next,S52-V2,06/15] i40e: set broadcast promiscuous mode for each active VLAN", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b1f19321e74f59bacb107cc27f047e535a8d1e54", "submitter": { "id": 68919, "url": "http://patchwork.ozlabs.org/api/people/68919/?format=api", "name": "Pujari, Bimmy", "email": "bimmy.pujari@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/1478639119-14656-7-git-send-email-bimmy.pujari@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/692501/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/692501/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3tD21q3fSGz9t1d\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 9 Nov 2016 08:07:11 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id DAF66C1140;\n\tTue, 8 Nov 2016 21:07:09 +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 4cFFvCfeAAJb; Tue, 8 Nov 2016 21:07:08 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 2A15DC1336;\n\tTue, 8 Nov 2016 21:07:08 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id CED941C22F9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 8 Nov 2016 21:07:01 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id CD3CB2E50D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 8 Nov 2016 21:07:01 +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 IjflvjEu-BwN for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 8 Nov 2016 21:06:54 +0000 (UTC)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 8B37A31A40\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 8 Nov 2016 21:06:54 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga105.fm.intel.com with ESMTP; 08 Nov 2016 13:06:54 -0800", "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby fmsmga002.fm.intel.com with ESMTP; 08 Nov 2016 13:06:53 -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.31,611,1473145200\"; d=\"scan'208\";\n\ta=\"1082486396\"", "From": "Bimmy Pujari <bimmy.pujari@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 8 Nov 2016 13:05:10 -0800", "Message-Id": "<1478639119-14656-7-git-send-email-bimmy.pujari@intel.com>", "X-Mailer": "git-send-email 2.4.11", "In-Reply-To": "<1478639119-14656-1-git-send-email-bimmy.pujari@intel.com>", "References": "<1478639119-14656-1-git-send-email-bimmy.pujari@intel.com>", "Subject": "[Intel-wired-lan] [next PATCH S52-V2 06/15] i40e: set broadcast\n\tpromiscuous mode for each active VLAN", "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": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nA previous workaround added to ensure receipt of all broadcast frames\nincorrectly set the broadcast promiscuous mode unconditionally\nregardless of active VLAN status.\n\nReplace this partial workaround with a complete solution that sets the\nbroadcast promiscuous filters in i40e_sync_vsi_filters. This new method\nsets the promiscuous mode based on when broadcast filters are added or\nremoved.\n\nI40E_VLAN_ANY will request a broadcast filter for all VLANs, (as we're\nin untagged mode) while a broadcast filter on a specific VLAN will only\nrequest broadcast for that VLAN.\n\nThus, we restore addition of broadcast filter to the array, but we add\nspecial handling for these such that they enable the broadcast\npromiscuous mode instead of being sent as regular filters.\n\nThe end result is that we will correctly receive all broadcast packets\n(even those with a *source* address equal to the broadcast address) but\nwill not receive packets for which we don't have an active VLAN filter.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-ID: I7d0585c5cec1a5bf55bf533b42e5e817d5db6a2d\n---\nTesting-hints:\n Ensure that we do not receive broadcast packets for VLANs which are\n not configured. That is, when we no VLANs configured we need to\n receive broadcast packets on all VLANs. When we have added a VLAN\n filter, we need to receive broadcasts only on VID=0 and any active\n VLANs, but *not* any in-actve VLANs.\n\n Additionally we need to ensure that we do not break the receipt of\n broadcast filters with a *source* address equal to the broadcast\n address. This can be tested using scapy or similar tools. Ensure that\n these packets follow the same receipt rules as above.\n\n Additionally it may be worth checking whether adding many VLANs\n rapidly does not cause any driver stability issues and that the\n broadcast packets are still correctly received.\n\n drivers/net/ethernet/intel/i40e/i40e_common.c | 34 +++++++\n drivers/net/ethernet/intel/i40e/i40e_main.c | 106 +++++++++++++++++----\n drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +\n drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 ++\n 4 files changed, 129 insertions(+), 21 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c\nindex 33bcf23..d1dcd4f 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_common.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c\n@@ -2170,6 +2170,40 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,\n }\n \n /**\n+ * i40e_aq_set_vsi_bc_promisc_on_vlan\n+ * @hw: pointer to the hw struct\n+ * @seid: vsi number\n+ * @enable: set broadcast promiscuous enable/disable for a given VLAN\n+ * @vid: The VLAN tag filter - capture any broadcast packet with this VLAN tag\n+ * @cmd_details: pointer to command details structure or NULL\n+ **/\n+i40e_status i40e_aq_set_vsi_bc_promisc_on_vlan(struct i40e_hw *hw,\n+\t\t\t\tu16 seid, bool enable, u16 vid,\n+\t\t\t\tstruct i40e_asq_cmd_details *cmd_details)\n+{\n+\tstruct i40e_aq_desc desc;\n+\tstruct i40e_aqc_set_vsi_promiscuous_modes *cmd =\n+\t\t(struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw;\n+\ti40e_status status;\n+\tu16 flags = 0;\n+\n+\ti40e_fill_default_direct_cmd_desc(&desc,\n+\t\t\t\t\ti40e_aqc_opc_set_vsi_promiscuous_modes);\n+\n+\tif (enable)\n+\t\tflags |= I40E_AQC_SET_VSI_PROMISC_BROADCAST;\n+\n+\tcmd->promiscuous_flags = cpu_to_le16(flags);\n+\tcmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_BROADCAST);\n+\tcmd->seid = cpu_to_le16(seid);\n+\tcmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID);\n+\n+\tstatus = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);\n+\n+\treturn status;\n+}\n+\n+/**\n * i40e_aq_set_vsi_broadcast\n * @hw: pointer to the hw struct\n * @seid: vsi number\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 3886119..8187d32 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1245,13 +1245,6 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,\n \tif (!vsi || !macaddr)\n \t\treturn NULL;\n \n-\t/* Do not allow broadcast filter to be added since broadcast filter\n-\t * is added as part of add VSI for any newly created VSI except\n-\t * FDIR VSI\n-\t */\n-\tif (is_broadcast_ether_addr(macaddr))\n-\t\treturn NULL;\n-\n \tf = i40e_find_filter(vsi, macaddr, vlan);\n \tif (!f) {\n \t\tf = kzalloc(sizeof(*f), GFP_ATOMIC);\n@@ -1857,6 +1850,47 @@ void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,\n }\n \n /**\n+ * i40e_aqc_broadcast_filter - Set promiscuous broadcast flags\n+ * @vsi: pointer to the VSI\n+ * @f: filter data\n+ *\n+ * This function sets or clears the promiscuous broadcast flags for VLAN\n+ * filters in order to properly receive broadcast frames. Assumes that only\n+ * broadcast filters are passed.\n+ **/\n+static\n+void i40e_aqc_broadcast_filter(struct i40e_vsi *vsi, const char *vsi_name,\n+\t\t\t struct i40e_mac_filter *f)\n+{\n+\tbool enable = f->state == I40E_FILTER_NEW;\n+\tstruct i40e_hw *hw = &vsi->back->hw;\n+\ti40e_status aq_ret;\n+\n+\tif (f->vlan == I40E_VLAN_ANY) {\n+\t\taq_ret = i40e_aq_set_vsi_broadcast(hw,\n+\t\t\t\t\t\t vsi->seid,\n+\t\t\t\t\t\t enable,\n+\t\t\t\t\t\t NULL);\n+\t} else {\n+\t\taq_ret = i40e_aq_set_vsi_bc_promisc_on_vlan(hw,\n+\t\t\t\t\t\t\t vsi->seid,\n+\t\t\t\t\t\t\t enable,\n+\t\t\t\t\t\t\t f->vlan,\n+\t\t\t\t\t\t\t NULL);\n+\t}\n+\n+\tif (aq_ret) {\n+\t\tdev_warn(&vsi->back->pdev->dev,\n+\t\t\t \"Error %s setting broadcast promiscuous mode on %s\\n\",\n+\t\t\t i40e_aq_str(hw, hw->aq.asq_last_status),\n+\t\t\t vsi_name);\n+\t\tf->state = I40E_FILTER_FAILED;\n+\t} else if (enable) {\n+\t\tf->state = I40E_FILTER_ACTIVE;\n+\t}\n+}\n+\n+/**\n * i40e_sync_vsi_filters - Update the VSI filter list to the HW\n * @vsi: ptr to the VSI\n *\n@@ -2004,6 +2038,17 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\thlist_for_each_entry_safe(f, h, &tmp_del_list, hlist) {\n \t\t\tcmd_flags = 0;\n \n+\t\t\t/* handle broadcast filters by updating the broadcast\n+\t\t\t * promiscuous flag instead of deleting a MAC filter.\n+\t\t\t */\n+\t\t\tif (is_broadcast_ether_addr(f->macaddr)) {\n+\t\t\t\ti40e_aqc_broadcast_filter(vsi, vsi_name, f);\n+\n+\t\t\t\thlist_del(&f->hlist);\n+\t\t\t\tkfree(f);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n \t\t\t/* add to delete list */\n \t\t\tether_addr_copy(del_list[num_del].mac_addr, f->macaddr);\n \t\t\tif (f->vlan == I40E_VLAN_ANY) {\n@@ -2060,12 +2105,25 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t\tgoto err_no_memory;\n \n \t\tnum_add = 0;\n-\t\thlist_for_each_entry(f, &tmp_add_list, hlist) {\n+\t\thlist_for_each_entry_safe(f, h, &tmp_add_list, hlist) {\n \t\t\tif (test_bit(__I40E_FILTER_OVERFLOW_PROMISC,\n \t\t\t\t &vsi->state)) {\n \t\t\t\tf->state = I40E_FILTER_FAILED;\n \t\t\t\tcontinue;\n \t\t\t}\n+\n+\t\t\t/* handle broadcast filters by updating the broadcast\n+\t\t\t * promiscuous flag instead of adding a MAC filter.\n+\t\t\t */\n+\t\t\tif (is_broadcast_ether_addr(f->macaddr)) {\n+\t\t\t\tu64 key = i40e_addr_to_hkey(f->macaddr);\n+\t\t\t\ti40e_aqc_broadcast_filter(vsi, vsi_name, f);\n+\n+\t\t\t\thlist_del(&f->hlist);\n+\t\t\t\thash_add(vsi->mac_filter_hash, &f->hlist, key);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n \t\t\t/* add to add array */\n \t\t\tif (num_add == 0)\n \t\t\t\tadd_head = f;\n@@ -9166,6 +9224,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \tstruct i40e_hw *hw = &pf->hw;\n \tstruct i40e_netdev_priv *np;\n \tstruct net_device *netdev;\n+\tu8 broadcast[ETH_ALEN];\n \tu8 mac_addr[ETH_ALEN];\n \tint etherdev_size;\n \n@@ -9234,6 +9293,24 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)\n \t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t}\n \n+\t/* Add the broadcast filter so that we initially will receive\n+\t * broadcast packets. Note that when a new VLAN is first added the\n+\t * driver will convert all filters marked I40E_VLAN_ANY into VLAN\n+\t * specific filters as part of transitioning into \"vlan\" operation.\n+\t * When more VLANs are added, the driver will copy each existing MAC\n+\t * filter and add it for the new VLAN.\n+\t *\n+\t * Broadcast filters are handled specially by\n+\t * i40e_sync_filters_subtask, as the driver must to set the broadcast\n+\t * promiscuous bit instead of adding this directly as a MAC/VLAN\n+\t * filter. The subtask will update the correct broadcast promiscuous\n+\t * bits as VLANs become active or inactive.\n+\t */\n+\teth_broadcast_addr(broadcast);\n+\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n+\ti40e_add_filter(vsi, broadcast, I40E_VLAN_ANY);\n+\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n+\n \tether_addr_copy(netdev->dev_addr, mac_addr);\n \tether_addr_copy(netdev->perm_addr, mac_addr);\n \n@@ -9316,7 +9393,6 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi)\n static int i40e_add_vsi(struct i40e_vsi *vsi)\n {\n \tint ret = -ENODEV;\n-\ti40e_status aq_ret = 0;\n \tstruct i40e_pf *pf = vsi->back;\n \tstruct i40e_hw *hw = &pf->hw;\n \tstruct i40e_vsi_context ctxt;\n@@ -9506,18 +9582,6 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)\n \t\tvsi->seid = ctxt.seid;\n \t\tvsi->id = ctxt.vsi_number;\n \t}\n-\t/* Except FDIR VSI, for all other VSI set the broadcast filter */\n-\tif (vsi->type != I40E_VSI_FDIR) {\n-\t\taq_ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, true, NULL);\n-\t\tif (aq_ret) {\n-\t\t\tret = i40e_aq_rc_to_posix(aq_ret,\n-\t\t\t\t\t\t hw->aq.asq_last_status);\n-\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t \"set brdcast promisc failed, err %s, aq_err %s\\n\",\n-\t\t\t\t i40e_stat_str(hw, aq_ret),\n-\t\t\t\t i40e_aq_str(hw, hw->aq.asq_last_status));\n-\t\t}\n-\t}\n \n \tvsi->active_filters = 0;\n \tclear_bit(__I40E_FILTER_OVERFLOW_PROMISC, &vsi->state);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h\nindex b1bf64e..4e641a6 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h\n@@ -144,6 +144,9 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,\n \t\t\t\t\t\t\t u16 seid, bool enable,\n \t\t\t\t\t\t\t u16 vid,\n \t\t\t\tstruct i40e_asq_cmd_details *cmd_details);\n+i40e_status i40e_aq_set_vsi_bc_promisc_on_vlan(struct i40e_hw *hw,\n+\t\t\t\tu16 seid, bool enable, u16 vid,\n+\t\t\t\tstruct i40e_asq_cmd_details *cmd_details);\n i40e_status i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw,\n \t\t\t\tu16 seid, bool enable,\n \t\t\t\tstruct i40e_asq_cmd_details *cmd_details);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 46908c0..05ed49b 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -674,6 +674,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)\n \t}\n \tif (type == I40E_VSI_SRIOV) {\n \t\tu64 hena = i40e_pf_get_default_rss_hena(pf);\n+\t\tu8 broadcast[ETH_ALEN];\n \n \t\tvf->lan_vsi_idx = vsi->idx;\n \t\tvf->lan_vsi_id = vsi->id;\n@@ -696,6 +697,12 @@ 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_filter(vsi, broadcast,\n+\t\t\t\t vf->port_vlan_id ? vf->port_vlan_id : -1);\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 \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", "prefixes": [ "next", "S52-V2", "06/15" ] }