Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/951922/?format=api
{ "id": 951922, "url": "http://patchwork.ozlabs.org/api/patches/951922/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180801040433.5865-11-anirudh.venkataramanan@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": "<20180801040433.5865-11-anirudh.venkataramanan@intel.com>", "list_archive_url": null, "date": "2018-08-01T04:04:30", "name": "[v2,10/13] ice: Implement ice_bridge_getlink and ice_bridge_setlink", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "4aa4848ed67457c41a2d7f54648040add0dd44a3", "submitter": { "id": 73601, "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api", "name": "Anirudh Venkataramanan", "email": "anirudh.venkataramanan@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/20180801040433.5865-11-anirudh.venkataramanan@intel.com/mbox/", "series": [ { "id": 58674, "url": "http://patchwork.ozlabs.org/api/series/58674/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=58674", "date": "2018-08-01T04:04:20", "name": "Feature updates for ice", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/58674/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/951922/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/951922/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;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 41gKTK3g6gz9ryn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 1 Aug 2018 14:05:09 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 213CC87F22;\n\tWed, 1 Aug 2018 04:05:08 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id w4QK1Ht+4zx8; Wed, 1 Aug 2018 04:05:00 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 0E91D87F3C;\n\tWed, 1 Aug 2018 04:04:57 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id BDEA61C0BBC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 1 Aug 2018 04:04:54 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id BBC3225C00\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 1 Aug 2018 04:04:54 +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 uVD4kqfbMg1n for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 1 Aug 2018 04:04:54 +0000 (UTC)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby silver.osuosl.org (Postfix) with ESMTPS id EBD0D25636\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 1 Aug 2018 04:04:53 +0000 (UTC)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t31 Jul 2018 21:04:53 -0700", "from lnahar-mobl.amr.corp.intel.com (HELO\n\tavenkata-mobl4.localdomain) ([10.252.134.1])\n\tby FMSMGA003.fm.intel.com with ESMTP; 31 Jul 2018 21:04:52 -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-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,430,1526367600\"; d=\"scan'208\";a=\"69105122\"", "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Tue, 31 Jul 2018 21:04:30 -0700", "Message-Id": "<20180801040433.5865-11-anirudh.venkataramanan@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20180801040433.5865-1-anirudh.venkataramanan@intel.com>", "References": "<20180801040433.5865-1-anirudh.venkataramanan@intel.com>", "Subject": "[Intel-wired-lan] [PATCH v2 10/13] ice: Implement\n\tice_bridge_getlink and ice_bridge_setlink", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "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>", "MIME-Version": "1.0", "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: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>\n\nice_bridge_getlink returns the current bridge mode using\nndo_dflt_bridge_getlink and the mode parameter available in\nfirst_switch->bridge_mode.\n\nice_bridge_setlink is invoked when the bridge mode needs to\nchanged. The value to be changed to is available as a netlink\nmessage which is parsed in this function. If the mode has to\nbe changed, switch_flags is set appropriately (set ALLOW_LB\nfor VEB mode and clear it for VEPA mode) and ice_aq_update_vsi\nis called. Also change the unicast switch filter rules.\n\nSigned-off-by: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_main.c | 145 +++++++++++++++++++-\n drivers/net/ethernet/intel/ice/ice_switch.c | 41 ++++++\n drivers/net/ethernet/intel/ice/ice_switch.h | 1 +\n 3 files changed, 186 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 1e42833d8337..6b2bcd3c1d6e 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -3597,7 +3597,11 @@ static int ice_probe(struct pci_dev *pdev,\n \t\tgoto err_msix_misc_unroll;\n \t}\n \n-\tpf->first_sw->bridge_mode = BRIDGE_MODE_VEB;\n+\tif (hw->evb_veb)\n+\t\tpf->first_sw->bridge_mode = BRIDGE_MODE_VEB;\n+\telse\n+\t\tpf->first_sw->bridge_mode = BRIDGE_MODE_VEPA;\n+\n \tpf->first_sw->pf = pf;\n \n \t/* record the sw_id available for later use */\n@@ -5693,6 +5697,143 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)\n \treturn 0;\n }\n \n+/**\n+ * ice_bridge_getlink - Get the hardware bridge mode\n+ * @skb: skb buff\n+ * @pid: process id\n+ * @seq: RTNL message seq\n+ * @dev: the netdev being configured\n+ * @filter_mask: filter mask passed in\n+ * @nlflags: netlink flags passed in\n+ *\n+ * Return the bridge mode (VEB/VEPA)\n+ */\n+static int\n+ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,\n+\t\t struct net_device *dev, u32 filter_mask, int nlflags)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(dev);\n+\tstruct ice_vsi *vsi = np->vsi;\n+\tstruct ice_pf *pf = vsi->back;\n+\tu16 bmode;\n+\n+\tbmode = pf->first_sw->bridge_mode;\n+\n+\treturn ndo_dflt_bridge_getlink(skb, pid, seq, dev, bmode, 0, 0, nlflags,\n+\t\t\t\t filter_mask, NULL);\n+}\n+\n+/**\n+ * ice_vsi_update_bridge_mode - Update VSI for switching bridge mode (VEB/VEPA)\n+ * @vsi: Pointer to VSI structure\n+ * @bmode: Hardware bridge mode (VEB/VEPA)\n+ *\n+ * Returns 0 on success, negative on failure\n+ */\n+static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)\n+{\n+\tstruct device *dev = &vsi->back->pdev->dev;\n+\tstruct ice_aqc_vsi_props *vsi_props;\n+\tstruct ice_hw *hw = &vsi->back->hw;\n+\tstruct ice_vsi_ctx ctxt = { 0 };\n+\tenum ice_status status;\n+\n+\tvsi_props = &vsi->info;\n+\tctxt.info = vsi->info;\n+\n+\tif (bmode == BRIDGE_MODE_VEB)\n+\t\t/* change from VEPA to VEB mode */\n+\t\tctxt.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\telse\n+\t\t/* change from VEB to VEPA mode */\n+\t\tctxt.info.sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\tctxt.vsi_num = vsi->vsi_num;\n+\tctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);\n+\tstatus = ice_aq_update_vsi(hw, &ctxt, NULL);\n+\tif (status) {\n+\t\tdev_err(dev, \"update VSI for bridge mode failed, bmode = %d err %d aq_err %d\\n\",\n+\t\t\tbmode, status, hw->adminq.sq_last_status);\n+\t\treturn -EIO;\n+\t}\n+\t/* Update sw flags for book keeping */\n+\tif (bmode == BRIDGE_MODE_VEB)\n+\t\t/* change from VEPA to VEB mode */\n+\t\tvsi_props->sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\telse\n+\t\t/* change from VEB to VEPA mode */\n+\t\tvsi_props->sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_bridge_setlink - Set the hardware bridge mode\n+ * @dev: the netdev being configured\n+ * @nlh: RTNL message\n+ * @flags: bridge setlink flags\n+ *\n+ * Sets the bridge mode (VEB/VEPA) of the switch to which the netdev (VSI) is\n+ * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if\n+ * not already set for all VSIs connected to this switch. And also update the\n+ * unicast switch filter rules for the corresponding switch of the netdev.\n+ */\n+static int\n+ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,\n+\t\t u16 __always_unused flags)\n+{\n+\tstruct ice_netdev_priv *np = netdev_priv(dev);\n+\tstruct ice_pf *pf = np->vsi->back;\n+\tstruct nlattr *attr, *br_spec;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tenum ice_status status;\n+\tstruct ice_sw *pf_sw;\n+\tint rem, v, err = 0;\n+\n+\tpf_sw = pf->first_sw;\n+\t/* find the attribute in the netlink message */\n+\tbr_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC);\n+\n+\tnla_for_each_nested(attr, br_spec, rem) {\n+\t\t__u16 mode;\n+\n+\t\tif (nla_type(attr) != IFLA_BRIDGE_MODE)\n+\t\t\tcontinue;\n+\t\tmode = nla_get_u16(attr);\n+\t\tif (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB)\n+\t\t\treturn -EINVAL;\n+\t\t/* Continue if bridge mode is not being flipped */\n+\t\tif (mode == pf_sw->bridge_mode)\n+\t\t\tcontinue;\n+\t\t/* Iterates through the PF VSI list and update the loopback\n+\t\t * mode of the VSI\n+\t\t */\n+\t\tice_for_each_vsi(pf, v) {\n+\t\t\tif (!pf->vsi[v])\n+\t\t\t\tcontinue;\n+\t\t\terr = ice_vsi_update_bridge_mode(pf->vsi[v], mode);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t}\n+\n+\t\thw->evb_veb = (mode == BRIDGE_MODE_VEB);\n+\t\t/* Update the unicast switch filter rules for the corresponding\n+\t\t * switch of the netdev\n+\t\t */\n+\t\tstatus = ice_update_sw_rule_bridge_mode(hw);\n+\t\tif (status) {\n+\t\t\tnetdev_err(dev, \"update SW_RULE for bridge mode failed, = %d err %d aq_err %d\\n\",\n+\t\t\t\t mode, status, hw->adminq.sq_last_status);\n+\t\t\t/* revert hw->evb_veb */\n+\t\t\thw->evb_veb = (pf_sw->bridge_mode == BRIDGE_MODE_VEB);\n+\t\t\treturn -EIO;\n+\t\t}\n+\n+\t\tpf_sw->bridge_mode = mode;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n * ice_tx_timeout - Respond to a Tx Hang\n * @netdev: network interface device structure\n@@ -5905,6 +6046,8 @@ static const struct net_device_ops ice_netdev_ops = {\n \t.ndo_vlan_rx_add_vid = ice_vlan_rx_add_vid,\n \t.ndo_vlan_rx_kill_vid = ice_vlan_rx_kill_vid,\n \t.ndo_set_features = ice_set_features,\n+\t.ndo_bridge_getlink = ice_bridge_getlink,\n+\t.ndo_bridge_setlink = ice_bridge_setlink,\n \t.ndo_fdb_add = ice_fdb_add,\n \t.ndo_fdb_del = ice_fdb_del,\n \t.ndo_tx_timeout = ice_tx_timeout,\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c\nindex 2240485010c5..02455ce9eb91 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.c\n@@ -1128,6 +1128,47 @@ ice_update_pkt_fwd_rule(struct ice_hw *hw, struct ice_fltr_info *f_info)\n \treturn status;\n }\n \n+/**\n+ * ice_update_sw_rule_bridge_mode\n+ * @hw: pointer to the hw struct\n+ *\n+ * Updates unicast switch filter rules based on VEB/VEPA mode\n+ */\n+enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw)\n+{\n+\tstruct ice_switch_info *sw = hw->switch_info;\n+\tstruct ice_fltr_mgmt_list_entry *fm_entry;\n+\tenum ice_status status = 0;\n+\tstruct list_head *rule_head;\n+\tstruct mutex *rule_lock; /* Lock to protect filter rule list */\n+\n+\trule_lock = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;\n+\trule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;\n+\n+\tmutex_lock(rule_lock);\n+\tlist_for_each_entry(fm_entry, rule_head, list_entry) {\n+\t\tstruct ice_fltr_info *fi = &fm_entry->fltr_info;\n+\t\tu8 *addr = fi->l_data.mac.mac_addr;\n+\n+\t\t/* Update unicast Tx rules to reflect the selected\n+\t\t * VEB/VEPA mode\n+\t\t */\n+\t\tif ((fi->flag & ICE_FLTR_TX) && is_unicast_ether_addr(addr) &&\n+\t\t (fi->fltr_act == ICE_FWD_TO_VSI ||\n+\t\t fi->fltr_act == ICE_FWD_TO_VSI_LIST ||\n+\t\t fi->fltr_act == ICE_FWD_TO_Q ||\n+\t\t fi->fltr_act == ICE_FWD_TO_QGRP)) {\n+\t\t\tstatus = ice_update_pkt_fwd_rule(hw, fi);\n+\t\t\tif (status)\n+\t\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tmutex_unlock(rule_lock);\n+\n+\treturn status;\n+}\n+\n /**\n * ice_add_update_vsi_list\n * @hw: pointer to the hardware structure\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h\nindex 11a481644dac..646389ca1238 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.h\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.h\n@@ -169,6 +169,7 @@ ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,\n enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);\n \n /* Switch/bridge related commands */\n+enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);\n enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);\n enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);\n void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_id);\n", "prefixes": [ "v2", "10/13" ] }