get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42639,
    "url": "http://patches.dpdk.org/api/patches/42639/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1531156496-1702-2-git-send-email-alejandro.lucero@netronome.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": "<1531156496-1702-2-git-send-email-alejandro.lucero@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1531156496-1702-2-git-send-email-alejandro.lucero@netronome.com",
    "date": "2018-07-09T17:14:55",
    "name": "[1/2] ethdev: fix MAC changes when live change not supported",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "507ebaebc4168c9c966b41bf79fc7efd8aa3d512",
    "submitter": {
        "id": 270,
        "url": "http://patches.dpdk.org/api/people/270/?format=api",
        "name": "Alejandro Lucero",
        "email": "alejandro.lucero@netronome.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/1531156496-1702-2-git-send-email-alejandro.lucero@netronome.com/mbox/",
    "series": [
        {
            "id": 477,
            "url": "http://patches.dpdk.org/api/series/477/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=477",
            "date": "2018-07-09T17:14:54",
            "name": "support MAC changes when no live changes allowed",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/477/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42639/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42639/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F30157EB4;\n\tMon,  9 Jul 2018 19:15:11 +0200 (CEST)",
            "from netronome.com (host-79-78-33-110.static.as9105.net\n\t[79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 1797D5F2F;\n\tMon,  9 Jul 2018 19:15:08 +0200 (CEST)",
            "from netronome.com (localhost [127.0.0.1])\n\tby netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id\n\tw69HExL3001935; Mon, 9 Jul 2018 18:14:59 +0100",
            "(from alucero@localhost)\n\tby netronome.com (8.14.4/8.14.4/Submit) id w69HEx9p001934;\n\tMon, 9 Jul 2018 18:14:59 +0100"
        ],
        "From": "Alejandro Lucero <alejandro.lucero@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org",
        "Date": "Mon,  9 Jul 2018 18:14:55 +0100",
        "Message-Id": "<1531156496-1702-2-git-send-email-alejandro.lucero@netronome.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1531156496-1702-1-git-send-email-alejandro.lucero@netronome.com>",
        "References": "<1531156496-1702-1-git-send-email-alejandro.lucero@netronome.com>",
        "Subject": "[dpdk-dev] [PATCH 1/2] ethdev: fix MAC changes when live change not\n\tsupported",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Current code assumes a MAC change can occur when the port has been\nstarted. In fact, there are some NICs which require this port state\nfor being successful, but other NICs not always support MAC change\nin that case.\n\nThis patch supports a new device flag for a device advertising this\nlimitation, and if the flag is set, the MAC is changed before the\nport starts.\n\nFixes: af75078fece3 (\"first public release\")\nCc: stable@dpdk.org\n\nSigned-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>\n---\n lib/librte_ethdev/rte_ethdev.c | 28 +++++++++++++++++++---------\n lib/librte_ethdev/rte_ethdev.h |  2 ++\n 2 files changed, 21 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex a9977df..8dbc031 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -1254,19 +1254,14 @@ struct rte_eth_dev *\n }\n \n static void\n-rte_eth_dev_config_restore(uint16_t port_id)\n+rte_eth_dev_mac_restore(struct rte_eth_dev *dev,\n+\t\t\tstruct rte_eth_dev_info *dev_info)\n {\n-\tstruct rte_eth_dev *dev;\n-\tstruct rte_eth_dev_info dev_info;\n \tstruct ether_addr *addr;\n \tuint16_t i;\n \tuint32_t pool = 0;\n \tuint64_t pool_mask;\n \n-\tdev = &rte_eth_devices[port_id];\n-\n-\trte_eth_dev_info_get(port_id, &dev_info);\n-\n \t/* replay MAC address configuration including default MAC */\n \taddr = &dev->data->mac_addrs[0];\n \tif (*dev->dev_ops->mac_addr_set != NULL)\n@@ -1275,7 +1270,7 @@ struct rte_eth_dev *\n \t\t(*dev->dev_ops->mac_addr_add)(dev, addr, 0, pool);\n \n \tif (*dev->dev_ops->mac_addr_add != NULL) {\n-\t\tfor (i = 1; i < dev_info.max_mac_addrs; i++) {\n+\t\tfor (i = 1; i < dev_info->max_mac_addrs; i++) {\n \t\t\taddr = &dev->data->mac_addrs[i];\n \n \t\t\t/* skip zero address */\n@@ -1294,6 +1289,14 @@ struct rte_eth_dev *\n \t\t\t} while (pool_mask);\n \t\t}\n \t}\n+}\n+\n+static void\n+rte_eth_dev_config_restore(struct rte_eth_dev *dev,\n+\t\t\t   struct rte_eth_dev_info *dev_info, uint16_t port_id)\n+{\n+\tif (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))\n+\t\trte_eth_dev_mac_restore(dev, dev_info);\n \n \t/* replay promiscuous configuration */\n \tif (rte_eth_promiscuous_get(port_id) == 1)\n@@ -1312,6 +1315,7 @@ struct rte_eth_dev *\n rte_eth_dev_start(uint16_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tstruct rte_eth_dev_info dev_info;\n \tint diag;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n@@ -1327,13 +1331,19 @@ struct rte_eth_dev *\n \t\treturn 0;\n \t}\n \n+\trte_eth_dev_info_get(port_id, &dev_info);\n+\n+\t/* Lets restore MAC now if device does not support live change */\n+\tif (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR)\n+\t\trte_eth_dev_mac_restore(dev, &dev_info);\n+\n \tdiag = (*dev->dev_ops->dev_start)(dev);\n \tif (diag == 0)\n \t\tdev->data->dev_started = 1;\n \telse\n \t\treturn eth_err(port_id, diag);\n \n-\trte_eth_dev_config_restore(port_id);\n+\trte_eth_dev_config_restore(dev, &dev_info, port_id);\n \n \tif (dev->data->dev_conf.intr_conf.lsc == 0) {\n \t\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex 36e3984..85f6908 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -1309,6 +1309,8 @@ struct rte_eth_dev_owner {\n #define RTE_ETH_DEV_INTR_RMV     0x0008\n /** Device is port representor */\n #define RTE_ETH_DEV_REPRESENTOR  0x0010\n+/** Device does not support MAC change after started */\n+#define RTE_ETH_DEV_NOLIVE_MAC_ADDR  0x0020\n \n /**\n  * Iterates over valid ethdev ports owned by a specific owner.\n",
    "prefixes": [
        "1/2"
    ]
}