get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75930,
    "url": "https://patches.dpdk.org/api/patches/75930/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200825115305.58490-10-huwei013@chinasoftinc.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20200825115305.58490-10-huwei013@chinasoftinc.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200825115305.58490-10-huwei013@chinasoftinc.com",
    "date": "2020-08-25T11:53:03",
    "name": "[09/11] net/hns3: fix default MAC addr from firmware",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a80634798c902c4f2106d276f8059cc557fb3239",
    "submitter": {
        "id": 1537,
        "url": "https://patches.dpdk.org/api/people/1537/?format=api",
        "name": "Wei Hu (Xavier)",
        "email": "huwei013@chinasoftinc.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200825115305.58490-10-huwei013@chinasoftinc.com/mbox/",
    "series": [
        {
            "id": 11778,
            "url": "https://patches.dpdk.org/api/series/11778/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11778",
            "date": "2020-08-25T11:52:54",
            "name": "updates for hns3 PMD driver",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/11778/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/75930/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/75930/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 52921A04B1;\n\tTue, 25 Aug 2020 13:55:08 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8BD261C2A3;\n\tTue, 25 Aug 2020 13:53:51 +0200 (CEST)",
            "from mail.chinasoftinc.com (unknown [114.113.233.8])\n by dpdk.org (Postfix) with ESMTP id 2568D1C296\n for <dev@dpdk.org>; Tue, 25 Aug 2020 13:53:48 +0200 (CEST)",
            "from localhost.localdomain (65.49.108.226) by INCCAS002.ito.icss\n (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 25 Aug 2020\n 19:53:39 +0800"
        ],
        "From": "\"Wei Hu (Xavier)\" <huwei013@chinasoftinc.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@intel.com>, <xavier.huwei@huawei.com>",
        "Date": "Tue, 25 Aug 2020 19:53:03 +0800",
        "Message-ID": "<20200825115305.58490-10-huwei013@chinasoftinc.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200825115305.58490-1-huwei013@chinasoftinc.com>",
        "References": "<20200825115305.58490-1-huwei013@chinasoftinc.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[65.49.108.226]",
        "Subject": "[dpdk-dev] [PATCH 09/11] net/hns3: fix default MAC addr from\n\tfirmware",
        "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: Huisong Li <lihuisong@huawei.com>\n\nCurrently, default MAC address obtained from firmware in hns3 PF PMD driver\nis directly used by .mac_addr_set ops implementation function when the\nrte_eth_dev_start API function is executed. At this moment, if the default\nMAC addr isn't an unicast address, it will fail to set default MAC addr to\nhardware.\n\nSo this patch adds the validity check of default MAC addr in hns3 PF PMD\ndriver. We will use a random unicast address, if the default MAC address\nobtained from firmware is not a vailid unicast address.\n\nIn addition, this patch also adjusts the location of processing default MAC\naddr in hns3 VF PMD driver so as to increase relevance and readability of\nthe code.\n\nFixes: eab21776717 (\"net/hns3: support setting VF MAC address by PF driver\")\nFixes: d51867db65c (\"net/hns3: add initialization\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\nSigned-off-by: Chengchang Tang <tangchengchang@huawei.com>\n---\n drivers/net/hns3/hns3_ethdev.c    | 11 +++++++++++\n drivers/net/hns3/hns3_ethdev_vf.c | 29 ++++++++++++++---------------\n 2 files changed, 25 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 3827d3277..14e4b9e35 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -5574,6 +5574,8 @@ static int\n hns3_dev_init(struct rte_eth_dev *eth_dev)\n {\n \tstruct hns3_adapter *hns = eth_dev->data->dev_private;\n+\tchar mac_str[RTE_ETHER_ADDR_FMT_SIZE];\n+\tstruct rte_ether_addr *eth_addr;\n \tstruct hns3_hw *hw = &hns->hw;\n \tint ret;\n \n@@ -5646,6 +5648,15 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)\n \t\tgoto err_rte_zmalloc;\n \t}\n \n+\teth_addr = (struct rte_ether_addr *)hw->mac.mac_addr;\n+\tif (!rte_is_valid_assigned_ether_addr(eth_addr)) {\n+\t\trte_eth_random_addr(hw->mac.mac_addr);\n+\t\trte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,\n+\t\t\t\t(struct rte_ether_addr *)hw->mac.mac_addr);\n+\t\thns3_warn(hw, \"default mac_addr from firmware is an invalid \"\n+\t\t\t  \"unicast address, using random MAC address %s\",\n+\t\t\t  mac_str);\n+\t}\n \trte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr,\n \t\t\t    &eth_dev->data->mac_addrs[0]);\n \ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex 3b2ba69bb..7fd0e6a43 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1748,21 +1748,6 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev)\n \t\tgoto err_get_config;\n \t}\n \n-\t/*\n-\t * The hns3 PF ethdev driver in kernel support setting VF MAC address\n-\t * on the host by \"ip link set ...\" command. To avoid some incorrect\n-\t * scenes, for example, hns3 VF PMD driver fails to receive and send\n-\t * packets after user configure the MAC address by using the\n-\t * \"ip link set ...\" command, hns3 VF PMD driver keep the same MAC\n-\t * address strategy as the hns3 kernel ethdev driver in the\n-\t * initialization. If user configure a MAC address by the ip command\n-\t * for VF device, then hns3 VF PMD driver will start with it, otherwise\n-\t * start with a random MAC address in the initialization.\n-\t */\n-\tret = rte_is_zero_ether_addr((struct rte_ether_addr *)hw->mac.mac_addr);\n-\tif (ret)\n-\t\trte_eth_random_addr(hw->mac.mac_addr);\n-\n \tret = hns3vf_clear_vport_list(hw);\n \tif (ret) {\n \t\tPMD_INIT_LOG(ERR, \"Failed to clear tbl list: %d\", ret);\n@@ -2644,8 +2629,22 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)\n \t\tgoto err_rte_zmalloc;\n \t}\n \n+\t/*\n+\t * The hns3 PF ethdev driver in kernel support setting VF MAC address\n+\t * on the host by \"ip link set ...\" command. To avoid some incorrect\n+\t * scenes, for example, hns3 VF PMD driver fails to receive and send\n+\t * packets after user configure the MAC address by using the\n+\t * \"ip link set ...\" command, hns3 VF PMD driver keep the same MAC\n+\t * address strategy as the hns3 kernel ethdev driver in the\n+\t * initialization. If user configure a MAC address by the ip command\n+\t * for VF device, then hns3 VF PMD driver will start with it, otherwise\n+\t * start with a random MAC address in the initialization.\n+\t */\n+\tif (rte_is_zero_ether_addr((struct rte_ether_addr *)hw->mac.mac_addr))\n+\t\trte_eth_random_addr(hw->mac.mac_addr);\n \trte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr,\n \t\t\t    &eth_dev->data->mac_addrs[0]);\n+\n \thw->adapter_state = HNS3_NIC_INITIALIZED;\n \t/*\n \t * Pass the information to the rte_eth_dev_close() that it should also\n",
    "prefixes": [
        "09/11"
    ]
}