get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 78399,
    "url": "http://patches.dpdk.org/api/patches/78399/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200922120329.21185-3-huwei013@chinasoftinc.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": "<20200922120329.21185-3-huwei013@chinasoftinc.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200922120329.21185-3-huwei013@chinasoftinc.com",
    "date": "2020-09-22T12:03:14",
    "name": "[v2,02/17] net/hns3: fix default VLAN won't be deleted when set PF PVID",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e0745a1ea98e8767ad8f89eaed4ec715edc8686d",
    "submitter": {
        "id": 1537,
        "url": "http://patches.dpdk.org/api/people/1537/?format=api",
        "name": "Wei Hu (Xavier)",
        "email": "huwei013@chinasoftinc.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/20200922120329.21185-3-huwei013@chinasoftinc.com/mbox/",
    "series": [
        {
            "id": 12408,
            "url": "http://patches.dpdk.org/api/series/12408/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12408",
            "date": "2020-09-22T12:03:12",
            "name": "updates for hns3 PMD driver",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/12408/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/78399/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/78399/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 87B1AA04B0;\n\tTue, 22 Sep 2020 14:04:01 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 718D81DAED;\n\tTue, 22 Sep 2020 14:03:47 +0200 (CEST)",
            "from incedge.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id ED6981DAD6\n for <dev@dpdk.org>; Tue, 22 Sep 2020 14:03:41 +0200 (CEST)",
            "from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by\n incedge.chinasoftinc.com with ESMTP id Oksz4KEINhDuO2Bz (version=TLSv1\n cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO);\n Tue, 22 Sep 2020 20:03:39 +0800 (CST)",
            "from localhost.localdomain (120.133.139.157) by INCCAS002.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 22 Sep 2020\n 20:03:39 +0800"
        ],
        "X-ASG-Debug-ID": "1600776219-149d111bae1ab8c0001-TfluYd",
        "X-Barracuda-Envelope-From": "huwei013@chinasoftinc.com",
        "X-Barracuda-RBL-Trusted-Forwarder": [
            "10.168.0.52",
            "10.168.0.60"
        ],
        "X-ASG-Whitelist": "Client",
        "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<xavier.huwei@huawei.com>",
        "Date": "Tue, 22 Sep 2020 20:03:14 +0800",
        "X-ASG-Orig-Subj": "[PATCH v2 02/17] net/hns3: fix default VLAN won't be deleted\n when set PF PVID",
        "Message-ID": "<20200922120329.21185-3-huwei013@chinasoftinc.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20200922120329.21185-1-huwei013@chinasoftinc.com>",
        "References": "<20200922085401.12272-1-huwei013@chinasoftinc.com>\n <20200922120329.21185-1-huwei013@chinasoftinc.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[120.133.139.157]",
        "X-Barracuda-Connect": "inccas002.ito.icss[10.168.0.52]",
        "X-Barracuda-Start-Time": "1600776219",
        "X-Barracuda-Encrypted": "ECDHE-RSA-AES256-SHA",
        "X-Barracuda-URL": "https://incspam.chinasofti.com:443/cgi-mod/mark.cgi",
        "X-Virus-Scanned": "by bsmtpd at chinasoftinc.com",
        "X-Barracuda-Scan-Msg-Size": "8606",
        "Subject": "[dpdk-dev] [PATCH v2 02/17] net/hns3: fix default VLAN won't be\n\tdeleted when set PF PVID",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Chengchang Tang <tangchengchang@huawei.com>\n\nCurrently, the default VLAN (vlan id 0) will never be deleted from the\nhardware VLAN table based on hns3 PF device. As a result, even a non-zero\nPVID is set by calling rte_eth_dev_set_vlan_pvid based on hns3 PF device,\npackets with VLAN 0 and without VLAN are still received by PF driver in Rx\ndirection.\n\nThis patch deletes the restriction that VLAN 0 cannot be removed in PVID\nconfiguration to ensure packets without PVID will be filtered when PVID\nis set. And the patch adds VLAN 0 to the soft list when initing vlan\nconfiguration to ensure that VLAN 0 will be deleted from the hardware VLAN\ntable when device is closed.\n\nFixes: 411d23b9eafb (\"net/hns3: support VLAN\")\nCc: stable@dpdk.org\n\nSigned-off-by: Chengchang Tang <tangchengchang@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\n---\nv1 -> v2:\n\t fix TYPO_SPELLING with INVALID.\n---\n drivers/net/hns3/hns3_ethdev.c | 105 +++++++++++++++++++----------------------\n 1 file changed, 48 insertions(+), 57 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 3e98df3..abc1742 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -35,7 +35,7 @@\n #define HNS3_DEFAULT_PORT_CONF_QUEUES_NUM\t1\n \n #define HNS3_SERVICE_INTERVAL\t\t1000000 /* us */\n-#define HNS3_INVLID_PVID\t\t0xFFFF\n+#define HNS3_INVALID_PVID\t\t0xFFFF\n \n #define HNS3_FILTER_TYPE_VF\t\t0\n #define HNS3_FILTER_TYPE_PORT\t\t1\n@@ -346,8 +346,9 @@ hns3_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on)\n \tint ret = 0;\n \n \t/*\n-\t * When vlan filter is enabled, hardware regards vlan id 0 as the entry\n-\t * for normal packet, deleting vlan id 0 is not allowed.\n+\t * When vlan filter is enabled, hardware regards packets without vlan\n+\t * as packets with vlan 0. So, to receive packets without vlan, vlan id\n+\t * 0 is not allowed to be removed by rte_eth_dev_vlan_filter.\n \t */\n \tif (on == 0 && vlan_id == 0)\n \t\treturn 0;\n@@ -364,7 +365,7 @@ hns3_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on)\n \t\twriten_to_tbl = true;\n \t}\n \n-\tif (ret == 0 && vlan_id) {\n+\tif (ret == 0) {\n \t\tif (on)\n \t\t\thns3_add_dev_vlan_table(hns, vlan_id, writen_to_tbl);\n \t\telse\n@@ -743,16 +744,6 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state,\n \treturn ret;\n }\n \n-static void\n-hns3_store_port_base_vlan_info(struct hns3_adapter *hns, uint16_t pvid, int on)\n-{\n-\tstruct hns3_hw *hw = &hns->hw;\n-\n-\thw->port_base_vlan_cfg.state = on ?\n-\t    HNS3_PORT_BASE_VLAN_ENABLE : HNS3_PORT_BASE_VLAN_DISABLE;\n-\n-\thw->port_base_vlan_cfg.pvid = pvid;\n-}\n \n static void\n hns3_rm_all_vlan_table(struct hns3_adapter *hns, bool is_del_list)\n@@ -761,10 +752,10 @@ hns3_rm_all_vlan_table(struct hns3_adapter *hns, bool is_del_list)\n \tstruct hns3_pf *pf = &hns->pf;\n \n \tLIST_FOREACH(vlan_entry, &pf->vlan_list, next) {\n-\t\tif (vlan_entry->hd_tbl_status)\n+\t\tif (vlan_entry->hd_tbl_status) {\n \t\t\thns3_set_port_vlan_filter(hns, vlan_entry->vlan_id, 0);\n-\n-\t\tvlan_entry->hd_tbl_status = false;\n+\t\t\tvlan_entry->hd_tbl_status = false;\n+\t\t}\n \t}\n \n \tif (is_del_list) {\n@@ -784,10 +775,10 @@ hns3_add_all_vlan_table(struct hns3_adapter *hns)\n \tstruct hns3_pf *pf = &hns->pf;\n \n \tLIST_FOREACH(vlan_entry, &pf->vlan_list, next) {\n-\t\tif (!vlan_entry->hd_tbl_status)\n+\t\tif (!vlan_entry->hd_tbl_status) {\n \t\t\thns3_set_port_vlan_filter(hns, vlan_entry->vlan_id, 1);\n-\n-\t\tvlan_entry->hd_tbl_status = true;\n+\t\t\tvlan_entry->hd_tbl_status = true;\n+\t\t}\n \t}\n }\n \n@@ -798,7 +789,7 @@ hns3_remove_all_vlan_table(struct hns3_adapter *hns)\n \tint ret;\n \n \thns3_rm_all_vlan_table(hns, true);\n-\tif (hw->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID) {\n+\tif (hw->port_base_vlan_cfg.pvid != HNS3_INVALID_PVID) {\n \t\tret = hns3_set_port_vlan_filter(hns,\n \t\t\t\t\t\thw->port_base_vlan_cfg.pvid, 0);\n \t\tif (ret) {\n@@ -811,40 +802,41 @@ hns3_remove_all_vlan_table(struct hns3_adapter *hns)\n \n static int\n hns3_update_vlan_filter_entries(struct hns3_adapter *hns,\n-\t\t\t\tuint16_t port_base_vlan_state,\n-\t\t\t\tuint16_t new_pvid, uint16_t old_pvid)\n+\t\t\tuint16_t port_base_vlan_state, uint16_t new_pvid)\n {\n \tstruct hns3_hw *hw = &hns->hw;\n-\tint ret = 0;\n+\tuint16_t old_pvid;\n+\tint ret;\n \n \tif (port_base_vlan_state == HNS3_PORT_BASE_VLAN_ENABLE) {\n-\t\tif (old_pvid != HNS3_INVLID_PVID && old_pvid != 0) {\n+\t\told_pvid = hw->port_base_vlan_cfg.pvid;\n+\t\tif (old_pvid != HNS3_INVALID_PVID) {\n \t\t\tret = hns3_set_port_vlan_filter(hns, old_pvid, 0);\n \t\t\tif (ret) {\n-\t\t\t\thns3_err(hw,\n-\t\t\t\t\t \"Failed to clear clear old pvid filter, ret =%d\",\n-\t\t\t\t\t ret);\n+\t\t\t\thns3_err(hw, \"failed to remove old pvid %u, \"\n+\t\t\t\t\t\t\"ret = %d\", old_pvid, ret);\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t}\n \n \t\thns3_rm_all_vlan_table(hns, false);\n-\t\treturn hns3_set_port_vlan_filter(hns, new_pvid, 1);\n-\t}\n-\n-\tif (new_pvid != 0) {\n+\t\tret = hns3_set_port_vlan_filter(hns, new_pvid, 1);\n+\t\tif (ret) {\n+\t\t\thns3_err(hw, \"failed to add new pvid %u, ret = %d\",\n+\t\t\t\t\tnew_pvid, ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t} else {\n \t\tret = hns3_set_port_vlan_filter(hns, new_pvid, 0);\n \t\tif (ret) {\n-\t\t\thns3_err(hw, \"Failed to set port vlan filter, ret =%d\",\n-\t\t\t\t ret);\n+\t\t\thns3_err(hw, \"failed to remove pvid %u, ret = %d\",\n+\t\t\t\t\tnew_pvid, ret);\n \t\t\treturn ret;\n \t\t}\n-\t}\n \n-\tif (new_pvid == hw->port_base_vlan_cfg.pvid)\n \t\thns3_add_all_vlan_table(hns);\n-\n-\treturn ret;\n+\t}\n+\treturn 0;\n }\n \n static int\n@@ -883,11 +875,10 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)\n {\n \tstruct hns3_hw *hw = &hns->hw;\n \tuint16_t port_base_vlan_state;\n-\tuint16_t old_pvid;\n \tint ret;\n \n \tif (on == 0 && pvid != hw->port_base_vlan_cfg.pvid) {\n-\t\tif (hw->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID)\n+\t\tif (hw->port_base_vlan_cfg.pvid != HNS3_INVALID_PVID)\n \t\t\thns3_warn(hw, \"Invalid operation! As current pvid set \"\n \t\t\t\t  \"is %u, disable pvid %u is invalid\",\n \t\t\t\t  hw->port_base_vlan_cfg.pvid, pvid);\n@@ -910,19 +901,18 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)\n \t\treturn ret;\n \t}\n \n-\tif (pvid == HNS3_INVLID_PVID)\n+\tif (pvid == HNS3_INVALID_PVID)\n \t\tgoto out;\n-\told_pvid = hw->port_base_vlan_cfg.pvid;\n-\tret = hns3_update_vlan_filter_entries(hns, port_base_vlan_state, pvid,\n-\t\t\t\t\t      old_pvid);\n+\tret = hns3_update_vlan_filter_entries(hns, port_base_vlan_state, pvid);\n \tif (ret) {\n-\t\thns3_err(hw, \"Failed to update vlan filter entries, ret =%d\",\n+\t\thns3_err(hw, \"failed to update vlan filter entries, ret = %d\",\n \t\t\t ret);\n \t\treturn ret;\n \t}\n \n out:\n-\thns3_store_port_base_vlan_info(hns, pvid, on);\n+\thw->port_base_vlan_cfg.state = port_base_vlan_state;\n+\thw->port_base_vlan_cfg.pvid = on ? pvid : HNS3_INVALID_PVID;\n \treturn ret;\n }\n \n@@ -968,20 +958,19 @@ hns3_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)\n \treturn 0;\n }\n \n-static void\n-init_port_base_vlan_info(struct hns3_hw *hw)\n-{\n-\thw->port_base_vlan_cfg.state = HNS3_PORT_BASE_VLAN_DISABLE;\n-\thw->port_base_vlan_cfg.pvid = HNS3_INVLID_PVID;\n-}\n-\n static int\n hns3_default_vlan_config(struct hns3_adapter *hns)\n {\n \tstruct hns3_hw *hw = &hns->hw;\n \tint ret;\n \n-\tret = hns3_set_port_vlan_filter(hns, 0, 1);\n+\t/*\n+\t * When vlan filter is enabled, hardware regards packets without vlan\n+\t * as packets with vlan 0. Therefore, if vlan 0 is not in the vlan\n+\t * table, packets without vlan won't be received. So, add vlan 0 as\n+\t * the default vlan.\n+\t */\n+\tret = hns3_vlan_filter_configure(hns, 0, 1);\n \tif (ret)\n \t\thns3_err(hw, \"default vlan 0 config failed, ret =%d\", ret);\n \treturn ret;\n@@ -1000,8 +989,10 @@ hns3_init_vlan_config(struct hns3_adapter *hns)\n \t * ensure that the hardware configuration remains unchanged before and\n \t * after reset.\n \t */\n-\tif (rte_atomic16_read(&hw->reset.resetting) == 0)\n-\t\tinit_port_base_vlan_info(hw);\n+\tif (rte_atomic16_read(&hw->reset.resetting) == 0) {\n+\t\thw->port_base_vlan_cfg.state = HNS3_PORT_BASE_VLAN_DISABLE;\n+\t\thw->port_base_vlan_cfg.pvid = HNS3_INVALID_PVID;\n+\t}\n \n \tret = hns3_vlan_filter_init(hns);\n \tif (ret) {\n@@ -1023,7 +1014,7 @@ hns3_init_vlan_config(struct hns3_adapter *hns)\n \t * and hns3_restore_vlan_conf later.\n \t */\n \tif (rte_atomic16_read(&hw->reset.resetting) == 0) {\n-\t\tret = hns3_vlan_pvid_configure(hns, HNS3_INVLID_PVID, 0);\n+\t\tret = hns3_vlan_pvid_configure(hns, HNS3_INVALID_PVID, 0);\n \t\tif (ret) {\n \t\t\thns3_err(hw, \"pvid set fail in pf, ret =%d\", ret);\n \t\t\treturn ret;\n",
    "prefixes": [
        "v2",
        "02/17"
    ]
}