get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 121702,
    "url": "http://patches.dpdk.org/api/patches/121702/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230109022027.190627-1-ke1x.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230109022027.190627-1-ke1x.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230109022027.190627-1-ke1x.zhang@intel.com",
    "date": "2023-01-09T02:20:27",
    "name": "net/i40e: disable source pruning",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3ded238b4726aea7b8aa69d72c7d7b42b03fc720",
    "submitter": {
        "id": 2503,
        "url": "http://patches.dpdk.org/api/people/2503/?format=api",
        "name": "Zhang, Ke1X",
        "email": "ke1x.zhang@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230109022027.190627-1-ke1x.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 26430,
            "url": "http://patches.dpdk.org/api/series/26430/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26430",
            "date": "2023-01-09T02:20:27",
            "name": "net/i40e: disable source pruning",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/26430/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/121702/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/121702/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 06C8242375;\n\tMon,  9 Jan 2023 03:34:24 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E381E40687;\n\tMon,  9 Jan 2023 03:34:23 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 594D04067C\n for <dev@dpdk.org>; Mon,  9 Jan 2023 03:34:22 +0100 (CET)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Jan 2023 18:34:20 -0800",
            "from unknown (HELO localhost.localdomain) ([10.239.252.104])\n by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Jan 2023 18:34:16 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1673231662; x=1704767662;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=UgZwylnlT32HMR0DNdb5lqiCz96/+fuDmqDLqcrwOuc=;\n b=WXr49o5IvdNLAUpHCRczL70l9K4IGGxtJe7vMMP6beIMMO5jCZoNka7Z\n 7KAVCNDtdUTmSKcqHQ8D2FzFLXwXyugIoeF4nyktcT6gQE99wt0UObokb\n qRoq9TcZH2mi6xeLZ+fnf87yMjQmRexPQFTOsd2Ma1/fcT6CMf+LxShhi\n cJbpIAOssVCzkWzcp2NI7EnAdgOU/5XJNv4ZXruJbWsA0vDsUjaG8KmCY\n WoJscjVYUs710JrET2TfOSiW1uw6IIsewF4byoSHY6lMT6M0lIt6vdR5a\n dzkRV4azQvZrjlEguVx87TQdtVhXrNPfP/Fvm+lCT2zUtqhP/VGWy5WIf Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10584\"; a=\"302478432\"",
            "E=Sophos;i=\"5.96,311,1665471600\"; d=\"scan'208\";a=\"302478432\"",
            "E=McAfee;i=\"6500,9779,10584\"; a=\"649873555\"",
            "E=Sophos;i=\"5.96,311,1665471600\"; d=\"scan'208\";a=\"649873555\""
        ],
        "From": "Ke Zhang <ke1x.zhang@intel.com>",
        "To": "dev@dpdk.org, mb@smartsharesystems.com, thomas@monjalon.net,\n ferruh.yigit@amd.com, olivier.matz@6wind.com, Yuying.Zhang@intel.com,\n beilei.xing@intel.com",
        "Cc": "Ke Zhang <ke1x.zhang@intel.com>",
        "Subject": "[PATCH] net/i40e: disable source pruning",
        "Date": "Mon,  9 Jan 2023 10:20:27 +0800",
        "Message-Id": "<20230109022027.190627-1-ke1x.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211020012831.8480-1-alvinx.zhang@intel.com>",
        "References": "<20211020012831.8480-1-alvinx.zhang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "VRRP advertisement packets are dropped on i40e PF devices because\nwhen a MAC address is added to a device, packets originating from\nthat MAC address are dropped.\n\nThis patch adds a interface in lib/ethdev to support disabling\nsource pruning to work around above issue.\n\nBugzilla ID: 648\n\nSigned-off-by: Ke Zhang <ke1x.zhang@intel.com>\n---\n app/test-pmd/cmdline.c         | 77 ++++++++++++++++++++++++++++++++++\n drivers/net/i40e/i40e_ethdev.c | 53 +++++++++++++++++++++++\n lib/ethdev/ethdev_driver.h     |  6 +++\n lib/ethdev/rte_ethdev.c        | 16 +++++++\n lib/ethdev/rte_ethdev.h        | 15 +++++++\n 5 files changed, 167 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex cb8c174020..a9602a2ed0 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -482,6 +482,9 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"set promisc (port_id|all) (on|off)\\n\"\n \t\t\t\"    Set the promiscuous mode on port_id, or all.\\n\\n\"\n \n+\t\t\t\"set llb (port_id|all) (on|off)\\n\"\n+\t\t\t\"    Set vsi local loopback on port_id, or all.\\n\\n\"\n+\n \t\t\t\"set allmulti (port_id|all) (on|off)\\n\"\n \t\t\t\"    Set the allmulti mode on port_id, or all.\\n\\n\"\n \n@@ -5775,6 +5778,78 @@ static cmdline_parse_inst_t cmd_set_promisc_mode_one = {\n \t},\n };\n \n+/* *** SET VSI LOCAL LOOPBACK *** */\n+struct cmd_set_vsi_local_lb_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t llb;\n+\tcmdline_fixed_string_t port_all; /* valid if \"allports\" argument == 1 */\n+\tuint16_t port_num;               /* valid if \"allports\" argument == 0 */\n+\tcmdline_fixed_string_t enable;\n+};\n+\n+static void cmd_set_vsi_llb_parsed(void *parsed_result,\n+\t\t\t\t\t__rte_unused struct cmdline *cl,\n+\t\t\t\t\tvoid *allports)\n+{\n+\tstruct cmd_set_vsi_local_lb_result *res = parsed_result;\n+\tint enable;\n+\tportid_t i;\n+\n+\tif (!strcmp(res->enable, \"on\"))\n+\t\tenable = 1;\n+\telse\n+\t\tenable = 0;\n+\n+\t/* all ports */\n+\tif (allports) {\n+\t\tRTE_ETH_FOREACH_DEV(i)\n+\t\t\trte_eth_dev_enable_local_lb(i, enable);\n+\t} else {\n+\t\trte_eth_dev_enable_local_lb(res->port_num, enable);\n+\t}\n+}\n+\n+static cmdline_parse_token_string_t cmd_setllb_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_vsi_local_lb_result, set, \"set\");\n+static cmdline_parse_token_string_t cmd_setllb_llb =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_vsi_local_lb_result, llb,\n+\t\t\t\t \"llb\");\n+static cmdline_parse_token_string_t cmd_setllb_portall =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_vsi_local_lb_result, port_all,\n+\t\t\t\t \"all\");\n+static cmdline_parse_token_num_t cmd_setllb_portnum =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_vsi_local_lb_result, port_num,\n+\t\t\t      RTE_UINT16);\n+static cmdline_parse_token_string_t cmd_setllb_enalbe =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_vsi_local_lb_result, enable,\n+\t\t\t\t \"on#off\");\n+\n+static cmdline_parse_inst_t cmd_set_vsi_enable_all = {\n+\t.f = cmd_set_vsi_llb_parsed,\n+\t.data = (void *)1,\n+\t.help_str = \"set llb all on|off: Set vsi local loopback for all ports\",\n+\t.tokens = {\n+\t\t(void *)&cmd_setllb_set,\n+\t\t(void *)&cmd_setllb_llb,\n+\t\t(void *)&cmd_setllb_portall,\n+\t\t(void *)&cmd_setllb_enalbe,\n+\t\tNULL,\n+\t},\n+};\n+\n+static cmdline_parse_inst_t cmd_set_vsi_enable_one = {\n+\t.f = cmd_set_vsi_llb_parsed,\n+\t.data = (void *)0,\n+\t.help_str = \"set llb <port_id> on|off: Set vsi local loopback on port id\",\n+\t.tokens = {\n+\t\t(void *)&cmd_setllb_set,\n+\t\t(void *)&cmd_setllb_llb,\n+\t\t(void *)&cmd_setllb_portnum,\n+\t\t(void *)&cmd_setllb_enalbe,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** SET ALLMULTI MODE *** */\n struct cmd_set_allmulti_mode_result {\n \tcmdline_fixed_string_t set;\n@@ -12866,6 +12941,8 @@ static cmdline_parse_ctx_t builtin_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_show_port_cman_capa,\n \t(cmdline_parse_inst_t *)&cmd_show_port_cman_config,\n \t(cmdline_parse_inst_t *)&cmd_set_port_cman_config,\n+\t(cmdline_parse_inst_t *)&cmd_set_vsi_enable_all,\n+\t(cmdline_parse_inst_t *)&cmd_set_vsi_enable_one,\n \tNULL,\n };\n \ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 7726a89d99..dd07c38f0f 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -406,6 +406,7 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf);\n static void i40e_tunnel_filter_restore(struct i40e_pf *pf);\n static void i40e_filter_restore(struct i40e_pf *pf);\n static void i40e_notify_all_vfs_link_status(struct rte_eth_dev *dev);\n+static int i40e_enable_pf_local_lb(struct rte_eth_dev *dev, int on);\n \n static const char *const valid_keys[] = {\n \tETH_I40E_FLOATING_VEB_ARG,\n@@ -517,6 +518,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {\n \t.tm_ops_get                   = i40e_tm_ops_get,\n \t.tx_done_cleanup              = i40e_tx_done_cleanup,\n \t.get_monitor_addr             = i40e_get_monitor_addr,\n+\t.enable_local_lb              = i40e_enable_pf_local_lb,\n };\n \n /* store statistics names and its offset in stats structure */\n@@ -5634,6 +5636,57 @@ i40e_enable_pf_lb(struct i40e_pf *pf)\n \t\t\t    hw->aq.asq_last_status);\n }\n \n+/* i40e_enable_pf_local_lb\n+ * @pf: pointer to the pf structure\n+ *\n+ * allow local loopback on pf\n+ */\n+static int\n+i40e_enable_pf_local_lb(struct rte_eth_dev *dev, int on)\n+{\n+\tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tstruct i40e_vsi_context ctxt;\n+\tint ret;\n+\n+\t/* Use the FW API if FW >= v5.0 */\n+\tif (hw->aq.fw_maj_ver < 5 && hw->mac.type != I40E_MAC_X722) {\n+#ifdef TREX_PATCH\n+\t\t/* Most of our customers do not have latest FW */\n+\t\tPMD_INIT_LOG(INFO, \"FW < v5.0, cannot enable local loopback\");\n+#else\n+\t\tPMD_INIT_LOG(ERR, \"FW < v5.0, cannot enable local loopback\");\n+#endif\n+\t\treturn I40E_NOT_SUPPORTED;\n+\t}\n+\n+\tmemset(&ctxt, 0, sizeof(ctxt));\n+\tctxt.seid = pf->main_vsi_seid;\n+\tctxt.pf_num = hw->pf_id;\n+\tret = i40e_aq_get_vsi_params(hw, &ctxt, NULL);\n+\tif (ret) {\n+\t\tPMD_DRV_LOG(ERR, \"cannot get pf vsi config, err %d, aq_err %d\",\n+\t\t\t    ret, hw->aq.asq_last_status);\n+\t\treturn ret;\n+\t}\n+\tctxt.flags = I40E_AQ_VSI_TYPE_PF;\n+\tctxt.info.valid_sections =\n+\t\trte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID);\n+\tif (on)\n+\t\tctxt.info.switch_id |=\n+\t\t\trte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);\n+\telse\n+\t\tctxt.info.switch_id &=\n+\t\t\t~rte_cpu_to_le_16(I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB);\n+\n+\tret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);\n+\tif (ret)\n+\t\tPMD_DRV_LOG(ERR, \"update vsi switch failed, aq_err=%d\",\n+\t\t\t    hw->aq.asq_last_status);\n+\n+\treturn ret;\n+}\n+\n /* Setup a VSI */\n struct i40e_vsi *\n i40e_vsi_setup(struct i40e_pf *pf,\ndiff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h\nindex 6a550cfc83..3a11a7fab4 100644\n--- a/lib/ethdev/ethdev_driver.h\n+++ b/lib/ethdev/ethdev_driver.h\n@@ -668,6 +668,10 @@ typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,\n typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,\n \t\t\t\t       struct rte_dev_eeprom_info *info);\n \n+/** @internal Function used to enable/disable the vsi loop back of an Ethernet device. */\n+typedef int (*eth_enable_local_lb_t)(struct rte_eth_dev *dev,\n+\t\t\t\t  int on);\n+\n struct rte_flow_ops;\n /**\n  * @internal\n@@ -1403,6 +1407,8 @@ struct eth_dev_ops {\n \teth_cman_config_set_t cman_config_set;\n \t/** Retrieve congestion management configuration */\n \teth_cman_config_get_t cman_config_get;\n+\t/** Enable/disable the vsi loop back of an Ethernet device */\n+\teth_enable_local_lb_t enable_local_lb;\n };\n \n /**\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 5d5e18db1e..3991688e2b 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -6318,6 +6318,22 @@ rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint32_t *ptypes\n \treturn j;\n }\n \n+int\n+rte_eth_dev_enable_local_lb(uint16_t port_id, int on)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tint ret;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\tdev = &rte_eth_devices[port_id];\n+\n+\tif (*dev->dev_ops->enable_local_lb == NULL)\n+\t\treturn -ENOTSUP;\n+\n+\tret = (*dev->dev_ops->enable_local_lb)(dev, on);\n+\treturn eth_err(port_id, ret);\n+}\n+\n RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO);\n \n RTE_INIT(ethdev_init_telemetry)\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex c129ca1eaf..c4888ebd62 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -3437,6 +3437,21 @@ int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu);\n  */\n int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on);\n \n+/**\n+ * Enable/Disable local Loopback for VSIs that are used as uplink of a software\n+ * (cascaded) VEB, VEPA or Port Virtualizer.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param on\n+ *   If > 0, enable local Loopback.\n+ *   Otherwise, disable local Loopback.\n+ * @return\n+ *   - (0) if successful.\n+ *   - negative if failed.\n+ */\n+int rte_eth_dev_enable_local_lb(uint16_t port_id, int on);\n+\n /**\n  * Enable/Disable hardware VLAN Strip by a Rx queue of an Ethernet device.\n  *\n",
    "prefixes": []
}