get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/948162/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 948162,
    "url": "http://patchwork.ozlabs.org/api/patches/948162/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180723231348.14838-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": "<20180723231348.14838-11-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-07-23T23:13:45",
    "name": "[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/20180723231348.14838-11-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 57159,
            "url": "http://patchwork.ozlabs.org/api/series/57159/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=57159",
            "date": "2018-07-23T23:13:35",
            "name": "Feature updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/57159/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/948162/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/948162/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.138; helo=whitealder.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 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 41ZHPH69WSz9s2M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 24 Jul 2018 09:14:11 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 7A8A682023;\n\tMon, 23 Jul 2018 23:14:10 +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 VHbeujcwcRaa; Mon, 23 Jul 2018 23:14:05 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id EF496874C0;\n\tMon, 23 Jul 2018 23:13:57 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 041481C1237\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Jul 2018 23:13:54 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 01E7E24527\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Jul 2018 23:13: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 5f0l4zU0l0gC for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Jul 2018 23:13:51 +0000 (UTC)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 3626B20784\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 23 Jul 2018 23:13:51 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Jul 2018 16:13:50 -0700",
            "from shasta.jf.intel.com ([10.166.241.10])\n\tby fmsmga006.fm.intel.com with ESMTP; 23 Jul 2018 16:13:49 -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,394,1526367600\"; d=\"scan'208\";a=\"248252740\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon, 23 Jul 2018 16:13:45 -0700",
        "Message-Id": "<20180723231348.14838-11-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.3",
        "In-Reply-To": "<20180723231348.14838-1-anirudh.venkataramanan@intel.com>",
        "References": "<20180723231348.14838-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH 10/13] ice: Implement ice_bridge_getlink\n\tand 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>",
        "Cc": "Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com>",
        "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 acb9a4055688..889631be02f9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -3601,7 +3601,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@@ -5697,6 +5701,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@@ -5909,6 +6050,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 40e069edd59f..c2e361287996 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.c\n@@ -1129,6 +1129,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": [
        "10/13"
    ]
}