get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35492,
    "url": "https://patches.dpdk.org/api/patches/35492/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180227151129.30387-1-olivier.matz@6wind.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": "<20180227151129.30387-1-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180227151129.30387-1-olivier.matz@6wind.com",
    "date": "2018-02-27T15:11:29",
    "name": "[dpdk-dev] ethdev: return diagnostic when setting MAC address",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "09fc6887ae88abb9349884bb4696470ba7f8a126",
    "submitter": {
        "id": 8,
        "url": "https://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.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/20180227151129.30387-1-olivier.matz@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/35492/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/35492/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 2838F4C74;\n\tTue, 27 Feb 2018 16:11:47 +0100 (CET)",
            "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 79CC54C72\n\tfor <dev@dpdk.org>; Tue, 27 Feb 2018 16:11:45 +0100 (CET)",
            "from glumotte.dev.6wind.com. (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id AFB2413AD44;\n\tTue, 27 Feb 2018 16:08:16 +0100 (CET)"
        ],
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "Thomas Monjalon <thomas@monjalon.net>,\n\tFerruh Yigit <ferruh.yigit@intel.com>",
        "Date": "Tue, 27 Feb 2018 16:11:29 +0100",
        "Message-Id": "<20180227151129.30387-1-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "Subject": "[dpdk-dev] [PATCH] ethdev: return diagnostic when setting MAC\n\taddress",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Change the prototype and the behavior of dev_ops->eth_mac_addr_set(): a\nreturn code is added to notify the caller (librte_ether) if an error\noccurred in the PMD.\n\nThe new default MAC address is now copied in dev->data->mac_addrs[0]\nonly if the operation is successful.\n\nThe patch also updates all the PMDs accordingly.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n\nHi,\n\nThis patch is the following of the discussion we had in this thread:\nhttps://dpdk.org/dev/patchwork/patch/32284/\n\nI did my best to keep the consistency inside the PMDs. The behavior\nof eth_mac_addr_set() is inspired from other fonctions in the same\nPMD, usually eth_mac_addr_add(). For instance:\n- dpaa and dpaa2 return 0 on error.\n- some PMDs (bnxt, mlx5, ...?) do not return a -errno code (-1 or\n  positive values).\n- some PMDs (avf, tap) check if the address is the same and return 0\n  in that case. This could go in generic code?\n\nI tried to use the following errors when relevant:\n- -EPERM when a VF is not allowed to do a change\n- -ENOTSUP if the function is not supported\n- -EIO if this is an unknown error from lower layer (hw or sdk)\n- -EINVAL for other unknown errors\n\nPlease, PMD maintainers, feel free to comment if you ahve specific\nneeds for your driver.\n\nThanks\nOlivier\n\n\n doc/guides/rel_notes/deprecation.rst    |  8 --------\n drivers/net/ark/ark_ethdev.c            |  9 ++++++---\n drivers/net/avf/avf_ethdev.c            | 12 ++++++++----\n drivers/net/bnxt/bnxt_ethdev.c          | 10 ++++++----\n drivers/net/bonding/rte_eth_bond_pmd.c  |  8 ++++++--\n drivers/net/dpaa/dpaa_ethdev.c          |  4 +++-\n drivers/net/dpaa2/dpaa2_ethdev.c        |  6 ++++--\n drivers/net/e1000/igb_ethdev.c          | 12 +++++++-----\n drivers/net/failsafe/failsafe_ops.c     | 16 +++++++++++++---\n drivers/net/i40e/i40e_ethdev.c          | 24 ++++++++++++++---------\n drivers/net/i40e/i40e_ethdev_vf.c       | 12 +++++++-----\n drivers/net/ixgbe/ixgbe_ethdev.c        | 13 ++++++++-----\n drivers/net/mlx4/mlx4.h                 |  2 +-\n drivers/net/mlx4/mlx4_ethdev.c          |  7 +++++--\n drivers/net/mlx5/mlx5.h                 |  2 +-\n drivers/net/mlx5/mlx5_mac.c             |  7 +++++--\n drivers/net/mrvl/mrvl_ethdev.c          |  7 ++++++-\n drivers/net/null/rte_eth_null.c         |  3 ++-\n drivers/net/octeontx/octeontx_ethdev.c  |  4 +++-\n drivers/net/qede/qede_ethdev.c          |  7 +++----\n drivers/net/sfc/sfc_ethdev.c            | 14 +++++---------\n drivers/net/szedata2/rte_eth_szedata2.c |  3 ++-\n drivers/net/tap/rte_eth_tap.c           | 34 +++++++++++++++++++++------------\n drivers/net/virtio/virtio_ethdev.c      | 15 ++++++++++-----\n drivers/net/vmxnet3/vmxnet3_ethdev.c    |  5 +++--\n lib/librte_ether/rte_ethdev.c           |  7 +++++--\n lib/librte_ether/rte_ethdev_core.h      |  2 +-\n test/test/virtual_pmd.c                 |  3 ++-\n 28 files changed, 159 insertions(+), 97 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst\nindex 74c18ed7c..2bf360f0d 100644\n--- a/doc/guides/rel_notes/deprecation.rst\n+++ b/doc/guides/rel_notes/deprecation.rst\n@@ -134,14 +134,6 @@ Deprecation Notices\n   between the VF representor and the VF or the parent PF. Those new fields\n   are to be included in ``rte_eth_dev_info`` struct.\n \n-* ethdev: The prototype and the behavior of\n-  ``dev_ops->eth_mac_addr_set()`` will change in v18.05. A return code\n-  will be added to notify the caller if an error occurred in the PMD. In\n-  ``rte_eth_dev_default_mac_addr_set()``, the new default MAC address\n-  will be copied in ``dev->data->mac_addrs[0]`` only if the operation is\n-  successful. This modification will only impact the PMDs, not the\n-  applications.\n-\n * ethdev: functions add rx/tx callback will return named opaque type\n   ``rte_eth_add_rx_callback()``, ``rte_eth_add_first_rx_callback()`` and\n   ``rte_eth_add_tx_callback()`` functions currently return callback object as\ndiff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c\nindex ff87c20e2..3fc40cd74 100644\n--- a/drivers/net/ark/ark_ethdev.c\n+++ b/drivers/net/ark/ark_ethdev.c\n@@ -69,7 +69,7 @@ static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);\n static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,\n \t\t\t\t  struct rte_eth_stats *stats);\n static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev);\n-static void eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t\t struct ether_addr *mac_addr);\n static int eth_ark_macaddr_add(struct rte_eth_dev *dev,\n \t\t\t       struct ether_addr *mac_addr,\n@@ -887,16 +887,19 @@ eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)\n \t\t\t      ark->user_data[dev->data->port_id]);\n }\n \n-static void\n+static int\n eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t     struct ether_addr *mac_addr)\n {\n \tstruct ark_adapter *ark =\n \t\t(struct ark_adapter *)dev->data->dev_private;\n \n-\tif (ark->user_ext.mac_addr_set)\n+\tif (ark->user_ext.mac_addr_set) {\n \t\tark->user_ext.mac_addr_set(dev, mac_addr,\n \t\t\t   ark->user_data[dev->data->port_id]);\n+\t\treturn 0;\n+\t}\n+\treturn -ENOTSUP;\n }\n \n static int\ndiff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c\nindex 4df661705..0866f0bed 100644\n--- a/drivers/net/avf/avf_ethdev.c\n+++ b/drivers/net/avf/avf_ethdev.c\n@@ -65,7 +65,7 @@ static int avf_dev_rss_hash_update(struct rte_eth_dev *dev,\n static int avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,\n \t\t\t\t     struct rte_eth_rss_conf *rss_conf);\n static int avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);\n-static void avf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int avf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t\t struct ether_addr *mac_addr);\n static int avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,\n \t\t\t\t\tuint16_t queue_id);\n@@ -926,7 +926,7 @@ avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)\n \treturn ret;\n }\n \n-static void\n+static int\n avf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t     struct ether_addr *mac_addr)\n {\n@@ -940,11 +940,11 @@ avf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n \tperm_addr = (struct ether_addr *)hw->mac.perm_addr;\n \n \tif (is_same_ether_addr(mac_addr, old_addr))\n-\t\treturn;\n+\t\treturn 0;\n \n \t/* If the MAC address is configured by host, skip the setting */\n \tif (is_valid_assigned_ether_addr(perm_addr))\n-\t\treturn;\n+\t\treturn -EPERM;\n \n \tret = avf_add_del_eth_addr(adapter, old_addr, FALSE);\n \tif (ret)\n@@ -968,7 +968,11 @@ avf_dev_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t    mac_addr->addr_bytes[4],\n \t\t\t    mac_addr->addr_bytes[5]);\n \n+\tif (ret)\n+\t\treturn -EIO;\n+\n \tether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr);\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex 21c46f833..8eb923ebb 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -1398,7 +1398,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)\n \treturn 0;\n }\n \n-static void\n+static int\n bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)\n {\n \tstruct bnxt *bp = (struct bnxt *)dev->data->dev_private;\n@@ -1408,7 +1408,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)\n \tint rc;\n \n \tif (BNXT_VF(bp))\n-\t\treturn;\n+\t\treturn -EPERM;\n \n \tmemcpy(bp->mac_addr, addr, sizeof(bp->mac_addr));\n \n@@ -1418,7 +1418,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)\n \t\t\tcontinue;\n \t\trc = bnxt_hwrm_clear_l2_filter(bp, filter);\n \t\tif (rc)\n-\t\t\tbreak;\n+\t\t\treturn rc;\n \t\tmemcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN);\n \t\tmemset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN);\n \t\tfilter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX;\n@@ -1427,10 +1427,12 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr)\n \t\t\tHWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;\n \t\trc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter);\n \t\tif (rc)\n-\t\t\tbreak;\n+\t\t\treturn rc;\n \t\tfilter->mac_index = 0;\n \t\tPMD_DRV_LOG(DEBUG, \"Set MAC addr\\n\");\n \t}\n+\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex c34c3251f..979d8efcd 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -2851,11 +2851,15 @@ bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)\n \treturn 0;\n }\n \n-static void\n+static int\n bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr)\n {\n-\tif (mac_address_set(dev, addr))\n+\tif (mac_address_set(dev, addr)) {\n \t\tRTE_BOND_LOG(ERR, \"Failed to update MAC address\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n }\n \n const struct eth_dev_ops default_dev_ops = {\ndiff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c\nindex 9b69ef456..8227446e4 100644\n--- a/drivers/net/dpaa/dpaa_ethdev.c\n+++ b/drivers/net/dpaa/dpaa_ethdev.c\n@@ -813,7 +813,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev,\n \tfman_if_clear_mac_addr(dpaa_intf->fif, index);\n }\n \n-static void\n+static int\n dpaa_dev_set_mac_addr(struct rte_eth_dev *dev,\n \t\t       struct ether_addr *addr)\n {\n@@ -825,6 +825,8 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev,\n \tret = fman_if_add_mac_addr(dpaa_intf->fif, addr->addr_bytes, 0);\n \tif (ret)\n \t\tRTE_LOG(ERR, PMD, \"error: Setting the MAC ADDR failed %d\", ret);\n+\n+\treturn 0;\n }\n \n static struct eth_dev_ops dpaa_devops = {\ndiff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c\nindex 09a11d65a..2d092e72c 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.c\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.c\n@@ -1074,7 +1074,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\"error: Removing the MAC ADDR failed: err = %d\\n\", ret);\n }\n \n-static void\n+static int\n dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev,\n \t\t       struct ether_addr *addr)\n {\n@@ -1086,7 +1086,7 @@ dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev,\n \n \tif (dpni == NULL) {\n \t\tRTE_LOG(ERR, PMD, \"dpni is NULL\\n\");\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \n \tret = dpni_set_primary_mac_addr(dpni, CMD_PRI_LOW,\n@@ -1095,6 +1095,8 @@ dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev,\n \tif (ret)\n \t\tRTE_LOG(ERR, PMD,\n \t\t\t\"error: Setting the MAC ADDR failed %d\\n\", ret);\n+\n+\treturn 0;\n }\n static\n int dpaa2_dev_stats_get(struct rte_eth_dev *dev,\ndiff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c\nindex 3c5138dea..e5be0d4a8 100644\n--- a/drivers/net/e1000/igb_ethdev.c\n+++ b/drivers/net/e1000/igb_ethdev.c\n@@ -146,7 +146,7 @@ static int eth_igb_rar_set(struct rte_eth_dev *dev,\n \t\t\t   struct ether_addr *mac_addr,\n \t\t\t   uint32_t index, uint32_t pool);\n static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index);\n-static void eth_igb_default_mac_addr_set(struct rte_eth_dev *dev,\n+static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev,\n \t\tstruct ether_addr *addr);\n \n static void igbvf_intr_disable(struct e1000_hw *hw);\n@@ -171,7 +171,7 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev,\n \t\tuint16_t vlan_id, int on);\n static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);\n static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on);\n-static void igbvf_default_mac_addr_set(struct rte_eth_dev *dev,\n+static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev,\n \t\tstruct ether_addr *addr);\n static int igbvf_get_reg_length(struct rte_eth_dev *dev);\n static int igbvf_get_regs(struct rte_eth_dev *dev,\n@@ -3146,13 +3146,14 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index)\n \te1000_rar_set(hw, addr, index);\n }\n \n-static void\n+static int\n eth_igb_default_mac_addr_set(struct rte_eth_dev *dev,\n \t\t\t\tstruct ether_addr *addr)\n {\n \teth_igb_rar_clear(dev, 0);\n-\n \teth_igb_rar_set(dev, (void *)addr, 0, 0);\n+\n+\treturn 0;\n }\n /*\n  * Virtual Function operations\n@@ -3504,7 +3505,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n \treturn 0;\n }\n \n-static void\n+static int\n igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr)\n {\n \tstruct e1000_hw *hw =\n@@ -3512,6 +3513,7 @@ igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr)\n \n \t/* index is not used by rar_set() */\n \thw->mac.ops.rar_set(hw, (void *)addr, 0);\n+\treturn 0;\n }\n \n \ndiff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c\nindex 057e435cf..d2f302ffb 100644\n--- a/drivers/net/failsafe/failsafe_ops.c\n+++ b/drivers/net/failsafe/failsafe_ops.c\n@@ -997,16 +997,26 @@ fs_mac_addr_add(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-static void\n+static int\n fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tstruct sub_device *sdev;\n \tuint8_t i;\n+\tint ret;\n \n \tfs_lock(dev, 0);\n-\tFOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)\n-\t\trte_eth_dev_default_mac_addr_set(PORT_ID(sdev), mac_addr);\n+\tFOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {\n+\t\tret = rte_eth_dev_default_mac_addr_set(PORT_ID(sdev), mac_addr);\n+\t\tif ((ret = fs_err(sdev, ret))) {\n+\t\t\tERROR(\"Operation rte_eth_dev_mac_addr_set failed for sub_device %\"\n+\t\t\t      PRIu8 \" with error %d\", i, ret);\n+\t\t\tfs_unlock(dev, 0);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n \tfs_unlock(dev, 0);\n+\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 508b4171c..455b1d0be 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -369,7 +369,7 @@ static int i40e_get_eeprom_length(struct rte_eth_dev *dev);\n static int i40e_get_eeprom(struct rte_eth_dev *dev,\n \t\t\t   struct rte_dev_eeprom_info *eeprom);\n \n-static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t      struct ether_addr *mac_addr);\n \n static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);\n@@ -11249,8 +11249,8 @@ static int i40e_get_eeprom(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n-\t\t\t\t      struct ether_addr *mac_addr)\n+static int i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n+\t\t\t\t     struct ether_addr *mac_addr)\n {\n \tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n@@ -11261,7 +11261,7 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n \n \tif (!is_valid_assigned_ether_addr(mac_addr)) {\n \t\tPMD_DRV_LOG(ERR, \"Tried to set invalid MAC address.\");\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \n \tTAILQ_FOREACH(f, &vsi->mac_list, next) {\n@@ -11271,25 +11271,31 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,\n \n \tif (f == NULL) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to find filter for default mac\");\n-\t\treturn;\n+\t\treturn -EIO;\n \t}\n \n \tmac_filter = f->mac_info;\n \tret = i40e_vsi_delete_mac(vsi, &mac_filter.mac_addr);\n \tif (ret != I40E_SUCCESS) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to delete mac filter\");\n-\t\treturn;\n+\t\treturn -EIO;\n \t}\n \tmemcpy(&mac_filter.mac_addr, mac_addr, ETH_ADDR_LEN);\n \tret = i40e_vsi_add_mac(vsi, &mac_filter);\n \tif (ret != I40E_SUCCESS) {\n \t\tPMD_DRV_LOG(ERR, \"Failed to add mac filter\");\n-\t\treturn;\n+\t\treturn -EIO;\n \t}\n \tmemcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN);\n \n-\ti40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_WOL,\n-\t\t\t\t  mac_addr->addr_bytes, NULL);\n+\tret = i40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_WOL,\n+\t\t\t\t\tmac_addr->addr_bytes, NULL);\n+\tif (ret != I40E_SUCCESS) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to change mac\");\n+\t\treturn -EIO;\n+\t}\n+\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c\nindex fd003fe01..df9709f80 100644\n--- a/drivers/net/i40e/i40e_ethdev_vf.c\n+++ b/drivers/net/i40e/i40e_ethdev_vf.c\n@@ -120,7 +120,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,\n static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,\n \t\t\t\t\tstruct rte_eth_rss_conf *rss_conf);\n static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);\n-static void i40evf_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t\tstruct ether_addr *mac_addr);\n static int\n i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);\n@@ -2658,7 +2658,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)\n \treturn ret;\n }\n \n-static void\n+static int\n i40evf_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t    struct ether_addr *mac_addr)\n {\n@@ -2667,15 +2667,17 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev,\n \n \tif (!is_valid_assigned_ether_addr(mac_addr)) {\n \t\tPMD_DRV_LOG(ERR, \"Tried to set invalid MAC address.\");\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \n \tif (vf->flags & I40E_FLAG_VF_MAC_BY_PF)\n-\t\treturn;\n+\t\treturn -EPERM;\n \n \ti40evf_del_mac_addr_by_addr(dev, (struct ether_addr *)hw->mac.addr);\n \n-\ti40evf_add_mac_addr(dev, mac_addr, 0, 0);\n+\tif (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0)\n+\t\treturn -EIO;\n \n \tether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr);\n+\treturn 0;\n }\ndiff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 448325857..4167b57e9 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -228,7 +228,7 @@ static void ixgbe_dev_interrupt_delayed_handler(void *param);\n static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr,\n \t\t\t uint32_t index, uint32_t pool);\n static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index);\n-static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int ixgbe_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t\t   struct ether_addr *mac_addr);\n static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config);\n static bool is_device_supported(struct rte_eth_dev *dev,\n@@ -286,7 +286,7 @@ static int ixgbevf_add_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\tstruct ether_addr *mac_addr,\n \t\t\t\tuint32_t index, uint32_t pool);\n static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);\n-static void ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev,\n+static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev,\n \t\t\t\t\t     struct ether_addr *mac_addr);\n static int ixgbe_syn_filter_get(struct rte_eth_dev *dev,\n \t\t\tstruct rte_eth_syn_filter *filter);\n@@ -4853,14 +4853,15 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index)\n \tixgbe_clear_rar(hw, index);\n }\n \n-static void\n+static int\n ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)\n {\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \n \tixgbe_remove_rar(dev, 0);\n-\n \tixgbe_add_rar(dev, addr, 0, pci_dev->max_vfs);\n+\n+\treturn 0;\n }\n \n static bool\n@@ -5983,12 +5984,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)\n \t}\n }\n \n-static void\n+static int\n ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)\n {\n \tstruct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \n \thw->mac.ops.set_rar(hw, 0, (void *)addr, 0, 0);\n+\n+\treturn 0;\n }\n \n int\ndiff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h\nindex 19c8a223d..c107794ce 100644\n--- a/drivers/net/mlx4/mlx4.h\n+++ b/drivers/net/mlx4/mlx4.h\n@@ -131,7 +131,7 @@ void mlx4_allmulticast_disable(struct rte_eth_dev *dev);\n void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);\n int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,\n \t\t      uint32_t index, uint32_t vmdq);\n-void mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr);\n+int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr);\n int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);\n int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);\n void mlx4_stats_reset(struct rte_eth_dev *dev);\ndiff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c\nindex 3bc692731..2442e16a6 100644\n--- a/drivers/net/mlx4/mlx4_ethdev.c\n+++ b/drivers/net/mlx4/mlx4_ethdev.c\n@@ -701,11 +701,14 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n  *   Pointer to Ethernet device structure.\n  * @param mac_addr\n  *   MAC address to register.\n+ *\n+ * @return\n+ *   0 on success, negative errno value otherwise and rte_errno is set.\n  */\n-void\n+int\n mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n-\tmlx4_mac_addr_add(dev, mac_addr, 0, 0);\n+\treturn mlx4_mac_addr_add(dev, mac_addr, 0, 0);\n }\n \n /**\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 965c19f21..42e58d7f7 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -241,7 +241,7 @@ int priv_get_mac(struct priv *, uint8_t (*)[ETHER_ADDR_LEN]);\n void mlx5_mac_addr_remove(struct rte_eth_dev *, uint32_t);\n int mlx5_mac_addr_add(struct rte_eth_dev *, struct ether_addr *, uint32_t,\n \t\t      uint32_t);\n-void mlx5_mac_addr_set(struct rte_eth_dev *, struct ether_addr *);\n+int mlx5_mac_addr_set(struct rte_eth_dev *, struct ether_addr *);\n \n /* mlx5_rss.c */\n \ndiff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c\nindex e8a8d4594..0dc4bec46 100644\n--- a/drivers/net/mlx5/mlx5_mac.c\n+++ b/drivers/net/mlx5/mlx5_mac.c\n@@ -118,10 +118,13 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,\n  *   Pointer to Ethernet device structure.\n  * @param mac_addr\n  *   MAC address to register.\n+ *\n+ * @return\n+ *   0 on success.\n  */\n-void\n+int\n mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tDEBUG(\"%p: setting primary MAC address\", (void *)dev);\n-\tmlx5_mac_addr_add(dev, mac_addr, 0, 0);\n+\treturn mlx5_mac_addr_add(dev, mac_addr, 0, 0);\n }\ndiff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c\nindex 705c4bd8b..8e14e54e2 100644\n--- a/drivers/net/mrvl/mrvl_ethdev.c\n+++ b/drivers/net/mrvl/mrvl_ethdev.c\n@@ -952,6 +952,9 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,\n  *   Pointer to Ethernet device structure.\n  * @param mac_addr\n  *   MAC address to register.\n+ *\n+ * @return\n+ *   0 on success, negative error value otherwise.\n  */\n static void\n mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n@@ -960,7 +963,7 @@ mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n \tint ret;\n \n \tif (!priv->ppio)\n-\t\treturn;\n+\t\treturn -EPERM;\n \n \tret = pp2_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes);\n \tif (ret) {\n@@ -968,6 +971,8 @@ mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n \t\tether_format_addr(buf, sizeof(buf), mac_addr);\n \t\tRTE_LOG(ERR, PMD, \"Failed to set mac to %s\\n\", buf);\n \t}\n+\n+\treturn ret;\n }\n \n /**\ndiff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c\nindex d003b2839..3b659cd23 100644\n--- a/drivers/net/null/rte_eth_null.c\n+++ b/drivers/net/null/rte_eth_null.c\n@@ -461,10 +461,11 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-static void\n+static int\n eth_mac_address_set(__rte_unused struct rte_eth_dev *dev,\n \t\t    __rte_unused struct ether_addr *addr)\n {\n+\treturn 0;\n }\n \n static const struct eth_dev_ops ops = {\ndiff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c\nindex b739c0b39..fabf86aa5 100644\n--- a/drivers/net/octeontx/octeontx_ethdev.c\n+++ b/drivers/net/octeontx/octeontx_ethdev.c\n@@ -594,7 +594,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev)\n \tocteontx_port_stats_clr(nic);\n }\n \n-static void\n+static int\n octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev,\n \t\t\t\t\tstruct ether_addr *addr)\n {\n@@ -605,6 +605,8 @@ octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev,\n \tif (ret != 0)\n \t\tocteontx_log_err(\"failed to set MAC address on port %d\",\n \t\t\t\tnic->port_id);\n+\n+\treturn ret;\n }\n \n static void\ndiff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c\nindex a91f43683..e4cd89511 100644\n--- a/drivers/net/qede/qede_ethdev.c\n+++ b/drivers/net/qede/qede_ethdev.c\n@@ -1001,7 +1001,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index)\n \tecore_filter_ucast_cmd(edev, &ucast, ECORE_SPQ_MODE_CB, NULL);\n }\n \n-static void\n+static int\n qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr)\n {\n \tstruct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);\n@@ -1010,12 +1010,11 @@ qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr)\n \tif (IS_VF(edev) && !ecore_vf_check_mac(ECORE_LEADING_HWFN(edev),\n \t\t\t\t\t       mac_addr->addr_bytes)) {\n \t\tDP_ERR(edev, \"Setting MAC address is not allowed\\n\");\n-\t\tether_addr_copy(&qdev->primary_mac,\n-\t\t\t\t&eth_dev->data->mac_addrs[0]);\n-\t\treturn;\n+\t\treturn -EPERM;\n \t}\n \n \tqede_mac_addr_add(eth_dev, mac_addr, 0, 0);\n+\treturn 0;\n }\n \n static void qede_config_accept_any_vlan(struct qede_dev *qdev, bool flg)\ndiff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c\nindex 89a452907..b76d4bb2c 100644\n--- a/drivers/net/sfc/sfc_ethdev.c\n+++ b/drivers/net/sfc/sfc_ethdev.c\n@@ -920,7 +920,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)\n \tSFC_ASSERT(rc > 0);\n \treturn -rc;\n }\n-static void\n+static int\n sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tstruct sfc_adapter *sa = dev->data->dev_private;\n@@ -939,13 +939,14 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n \tif (port->isolated) {\n \t\tsfc_err(sa, \"isolated mode is active on the port\");\n \t\tsfc_err(sa, \"will not set MAC address\");\n+\t\trc = ENOTSUP;\n \t\tgoto unlock;\n \t}\n \n \tif (sa->state != SFC_ADAPTER_STARTED) {\n \t\tsfc_info(sa, \"the port is not started\");\n \t\tsfc_info(sa, \"the new MAC address will be set on port start\");\n-\n+\t\trc = EINVAL;\n \t\tgoto unlock;\n \t}\n \n@@ -982,14 +983,9 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n \t}\n \n unlock:\n-\t/*\n-\t * In the case of failure sa->port->default_mac_addr does not\n-\t * need rollback since no error code is returned, and the upper\n-\t * API will anyway update the external MAC address storage.\n-\t * To be consistent with that new value it is better to keep\n-\t * the device private value the same.\n-\t */\n \tsfc_adapter_unlock(sa);\n+\tSFC_ASSERT(rc >= 0);\n+\treturn -rc;\n }\n \n \ndiff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c\nindex e53c738db..1a1e2356b 100644\n--- a/drivers/net/szedata2/rte_eth_szedata2.c\n+++ b/drivers/net/szedata2/rte_eth_szedata2.c\n@@ -1315,10 +1315,11 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-static void\n+static int\n eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused,\n \t\tstruct ether_addr *mac_addr __rte_unused)\n {\n+\treturn 0;\n }\n \n static void\ndiff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c\nindex f09db0ea9..ac99b233c 100644\n--- a/drivers/net/tap/rte_eth_tap.c\n+++ b/drivers/net/tap/rte_eth_tap.c\n@@ -929,48 +929,58 @@ tap_allmulti_disable(struct rte_eth_dev *dev)\n \t\ttap_flow_implicit_destroy(pmd, TAP_REMOTE_ALLMULTI);\n }\n \n-static void\n+static int\n tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tstruct pmd_internals *pmd = dev->data->dev_private;\n \tenum ioctl_mode mode = LOCAL_ONLY;\n \tstruct ifreq ifr;\n+\tint ret;\n \n \tif (is_zero_ether_addr(mac_addr)) {\n \t\tRTE_LOG(ERR, PMD, \"%s: can't set an empty MAC address\\n\",\n \t\t\tdev->device->name);\n-\t\treturn;\n+\t\treturn -EINVAL;\n \t}\n \t/* Check the actual current MAC address on the tap netdevice */\n-\tif (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0)\n-\t\treturn;\n+\tret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY);\n+\tif (ret < 0)\n+\t\treturn ret;\n \tif (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data,\n \t\t\t       mac_addr))\n-\t\treturn;\n+\t\treturn 0;\n \t/* Check the current MAC address on the remote */\n-\tif (tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY) < 0)\n-\t\treturn;\n+\tret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY);\n+\tif (ret < 0)\n+\t\treturn ret;\n \tif (!is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data,\n \t\t\t       mac_addr))\n \t\tmode = LOCAL_AND_REMOTE;\n \tifr.ifr_hwaddr.sa_family = AF_LOCAL;\n \trte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, ETHER_ADDR_LEN);\n-\tif (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode) < 0)\n-\t\treturn;\n+\tret = tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode);\n+\tif (ret < 0)\n+\t\treturn ret;\n \trte_memcpy(&pmd->eth_addr, mac_addr, ETHER_ADDR_LEN);\n \tif (pmd->remote_if_index && !pmd->flow_isolate) {\n \t\t/* Replace MAC redirection rule after a MAC change */\n-\t\tif (tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC) < 0) {\n+\t\tret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC);\n+\t\tif (ret < 0) {\n \t\t\tRTE_LOG(ERR, PMD,\n \t\t\t\t\"%s: Couldn't delete MAC redirection rule\\n\",\n \t\t\t\tdev->device->name);\n-\t\t\treturn;\n+\t\t\treturn ret;\n \t\t}\n-\t\tif (tap_flow_implicit_create(pmd, TAP_REMOTE_LOCAL_MAC) < 0)\n+\t\tret = tap_flow_implicit_create(pmd, TAP_REMOTE_LOCAL_MAC);\n+\t\tif (ret < 0) {\n \t\t\tRTE_LOG(ERR, PMD,\n \t\t\t\t\"%s: Couldn't add MAC redirection rule\\n\",\n \t\t\t\tdev->device->name);\n+\t\t\treturn ret;\n+\t\t}\n \t}\n+\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 884f74ad0..38a7a14f7 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -68,7 +68,7 @@ static int virtio_mac_addr_add(struct rte_eth_dev *dev,\n \t\t\t\tstruct ether_addr *mac_addr,\n \t\t\t\tuint32_t index, uint32_t vmdq);\n static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);\n-static void virtio_mac_addr_set(struct rte_eth_dev *dev,\n+static int virtio_mac_addr_set(struct rte_eth_dev *dev,\n \t\t\t\tstruct ether_addr *mac_addr);\n \n static int virtio_intr_enable(struct rte_eth_dev *dev);\n@@ -1097,7 +1097,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)\n \tvirtio_mac_table_set(hw, uc, mc);\n }\n \n-static void\n+static int\n virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tstruct virtio_hw *hw = dev->data->dev_private;\n@@ -1113,9 +1113,14 @@ virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n \t\tctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET;\n \n \t\tmemcpy(ctrl.data, mac_addr, ETHER_ADDR_LEN);\n-\t\tvirtio_send_command(hw->cvq, &ctrl, &len, 1);\n-\t} else if (vtpci_with_feature(hw, VIRTIO_NET_F_MAC))\n-\t\tvirtio_set_hwaddr(hw);\n+\t\treturn virtio_send_command(hw->cvq, &ctrl, &len, 1);\n+\t}\n+\n+\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_MAC))\n+\t\treturn -ENOTSUP;\n+\n+\tvirtio_set_hwaddr(hw);\n+\treturn 0;\n }\n \n static int\ndiff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c\nindex 4e68aae6b..13ee8f250 100644\n--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c\n+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c\n@@ -73,7 +73,7 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev);\n static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,\n \t\t\t\t       uint16_t vid, int on);\n static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);\n-static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,\n+static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev,\n \t\t\t\t struct ether_addr *mac_addr);\n static void vmxnet3_interrupt_handler(void *param);\n \n@@ -1117,13 +1117,14 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev)\n \treturn NULL;\n }\n \n-static void\n+static int\n vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)\n {\n \tstruct vmxnet3_hw *hw = dev->data->dev_private;\n \n \tether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr));\n \tvmxnet3_write_mac(hw, mac_addr->addr_bytes);\n+\treturn 0;\n }\n \n /* return 0 means link status changed, -1 means not changed */\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 0590f0c10..6a7330d92 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -3003,6 +3003,7 @@ int\n rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \n@@ -3012,11 +3013,13 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr)\n \tdev = &rte_eth_devices[port_id];\n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);\n \n+\tret = (*dev->dev_ops->mac_addr_set)(dev, addr);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n \t/* Update default address in NIC data structure */\n \tether_addr_copy(addr, &dev->data->mac_addrs[0]);\n \n-\t(*dev->dev_ops->mac_addr_set)(dev, addr);\n-\n \treturn 0;\n }\n \ndiff --git a/lib/librte_ether/rte_ethdev_core.h b/lib/librte_ether/rte_ethdev_core.h\nindex e5681e466..55eb2b09e 100644\n--- a/lib/librte_ether/rte_ethdev_core.h\n+++ b/lib/librte_ether/rte_ethdev_core.h\n@@ -255,7 +255,7 @@ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,\n \t\t\t\t  uint32_t vmdq);\n /**< @internal Set a MAC address into Receive Address Address Register */\n \n-typedef void (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,\n+typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,\n \t\t\t\t  struct ether_addr *mac_addr);\n /**< @internal Set a MAC address into Receive Address Address Register */\n \ndiff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c\nindex 2f5b31dba..69b4ba034 100644\n--- a/test/test/virtual_pmd.c\n+++ b/test/test/virtual_pmd.c\n@@ -216,10 +216,11 @@ static void\n virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused)\n {}\n \n-static void\n+static int\n virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev,\n \t\t\t       __rte_unused struct ether_addr *addr)\n {\n+\treturn 0;\n }\n \n static const struct eth_dev_ops virtual_ethdev_default_dev_ops = {\n",
    "prefixes": [
        "dpdk-dev"
    ]
}