get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43869,
    "url": "http://patches.dpdk.org/api/patches/43869/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1535120736-785-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": "<1535120736-785-2-git-send-email-alejandro.lucero@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1535120736-785-2-git-send-email-alejandro.lucero@netronome.com",
    "date": "2018-08-24T14:25:35",
    "name": "[v3,1/2] ethdev: fix MAC changes when live change not supported",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5dafa574ce20bb0e94a0b601a98cb07c778b897d",
    "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/1535120736-785-2-git-send-email-alejandro.lucero@netronome.com/mbox/",
    "series": [
        {
            "id": 1049,
            "url": "http://patches.dpdk.org/api/series/1049/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1049",
            "date": "2018-08-24T14:25:34",
            "name": "support MAC changes when no live changes allowed",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/1049/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43869/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43869/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 86C715B2C;\n\tFri, 24 Aug 2018 16:26:31 +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 6CC2558FA;\n\tFri, 24 Aug 2018 16:26:27 +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\tw7OEPdvx000917; Fri, 24 Aug 2018 15:25:39 +0100",
            "(from alucero@localhost)\n\tby netronome.com (8.14.4/8.14.4/Submit) id w7OEPdIr000916;\n\tFri, 24 Aug 2018 15:25:39 +0100"
        ],
        "From": "Alejandro Lucero <alejandro.lucero@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org, ferruh.yigit@intel.com",
        "Date": "Fri, 24 Aug 2018 15:25:35 +0100",
        "Message-Id": "<1535120736-785-2-git-send-email-alejandro.lucero@netronome.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1535120736-785-1-git-send-email-alejandro.lucero@netronome.com>",
        "References": "<1535120736-785-1-git-send-email-alejandro.lucero@netronome.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/2] ethdev: fix MAC changes when live change\n\tnot supported",
        "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 doc/guides/rel_notes/release_18_11.rst |  6 +++++-\n lib/librte_ethdev/rte_ethdev.c         | 28 +++++++++++++++++++---------\n lib/librte_ethdev/rte_ethdev.h         |  6 ++++++\n 3 files changed, 30 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst\nindex 3ae6b3f..b0c73bd 100644\n--- a/doc/guides/rel_notes/release_18_11.rst\n+++ b/doc/guides/rel_notes/release_18_11.rst\n@@ -67,7 +67,11 @@ API Changes\n    This section is a comment. Do not overwrite or remove it.\n    Also, make sure to start the actual text at the margin.\n    =========================================================\n-\n+   * A new device flag, RTE_ETH_DEV_NOLIVE_MAC_ADDR, changes the order of\n+     actions inside rte_eth_dev_start regarding MAC set. Some NICs do not\n+     support MAC changes once the port has started and with this new device\n+     flag the MAC can be properly configured in any case. This is particularly\n+     important for bonding.\n \n ABI Changes\n -----------\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex f32722f..16825bf 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -1219,19 +1219,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@@ -1240,7 +1235,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@@ -1259,6 +1254,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@@ -1277,6 +1280,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@@ -1292,13 +1296,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 7070e9a..fa2812b 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -1268,6 +1268,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@@ -1750,6 +1752,10 @@ int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,\n  * The device start step is the last one and consists of setting the configured\n  * offload features and in starting the transmit and the receive units of the\n  * device.\n+ *\n+ * Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before\n+ * PMD port start callback function is invoked.\n+ *\n  * On success, all basic functions exported by the Ethernet API (link status,\n  * receive/transmit, and so on) can be invoked.\n  *\n",
    "prefixes": [
        "v3",
        "1/2"
    ]
}