DPDK patches and discussions
 help / color / mirror / Atom feed
From: Liang-Min Larry Wang <liang-min.wang@intel.com>
To: dev@dpdk.org
Cc: Liang-Min Larry Wang <liang-min.wang@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address
Date: Fri, 29 May 2015 15:26:51 -0400	[thread overview]
Message-ID: <1432927612-12244-2-git-send-email-liang-min.wang@intel.com> (raw)
In-Reply-To: <1432927612-12244-1-git-send-email-liang-min.wang@intel.com>

add a new api: rte_eth_dev_default_mac_addr_set to
support changing default mac address of a NIC

Signed-off-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
---
 lib/librte_ether/rte_ethdev.c          | 16 ++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 14 ++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 3 files changed, 31 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 024fe8b..96ee00e 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2752,6 +2752,22 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
 }
 
 int
+rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
+{
+	struct rte_eth_dev *dev;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -ENODEV;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+
+	return (*dev->dev_ops->mac_addr_set)(dev, addr);
+}
+
+int
 rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
 				uint16_t rx_mode, uint8_t on)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16dbe00..5f07e0d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2982,6 +2982,20 @@ int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
 int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
 
 /**
+ * Set the default MAC address.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param mac_addr
+ *   New default MAC address.
+ * @return
+ *   - (0) if successful, or *mac_addr* didn't exist.
+ *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-ENODEV) if *port* invalid.
+ */
+int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
+
+/**
  * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
  *
  * @param port
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index a2d25a6..2dbbaa7 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -102,6 +102,7 @@ DPDK_2.0 {
 	rte_eth_tx_queue_setup;
 	rte_eth_xstats_get;
 	rte_eth_xstats_reset;
+	rte_eth_dev_default_mac_addr_set;
 
 	local: *;
 };
-- 
2.1.4

  reply	other threads:[~2015-05-29 19:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 19:26 [dpdk-dev] [PATCH 0/2] User-space Ethtool Liang-Min Larry Wang
2015-05-29 19:26 ` Liang-Min Larry Wang [this message]
2015-06-02 10:52   ` [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address Ananyev, Konstantin
2015-06-02 12:23     ` Thomas Monjalon
2015-06-02 14:51       ` Stephen Hemminger
2015-06-02 15:07         ` Wang, Liang-min
2015-06-02 12:23     ` Wang, Liang-min
2015-06-02 13:10       ` Ananyev, Konstantin
2015-05-29 19:26 ` [dpdk-dev] [PATCH 2/2] ethtool: add new library to provide ethtool-alike APIs Liang-Min Larry Wang
2015-06-02 12:38   ` Thomas Monjalon
2015-06-02 13:15     ` Wang, Liang-min
2015-06-02 14:32       ` Thomas Monjalon
2015-06-02 15:47         ` Wang, Liang-min
2015-06-02 16:02           ` Thomas Monjalon
2015-06-02 17:06             ` Wang, Liang-min
2015-06-02 20:37               ` Thomas Monjalon
2015-06-02 20:56                 ` Wang, Liang-min
2015-06-03  1:00                   ` David Harton (dharton)
2015-06-03  2:09                 ` Andrew Harvey (agh)
2015-06-04 14:25                   ` O'Driscoll, Tim
2015-06-04 14:58                   ` Stephen Hemminger
2015-06-04 22:10                     ` Andrew Harvey (agh)
2015-06-05 10:46                       ` Thomas Monjalon
2015-06-05 11:25                         ` Wang, Liang-min
2015-06-05 12:47                           ` Bruce Richardson
2015-06-05 17:24                             ` Andrew Harvey (agh)
2015-06-05 21:03                               ` Thomas Monjalon
2015-06-05 13:40                           ` Thomas Monjalon
2015-06-05 14:20                             ` Wang, Liang-min
2015-06-05 16:07                         ` Andrew Harvey (agh)
2015-06-05 20:57                           ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2015-05-30  0:37 [dpdk-dev] [PATCH 0/2] User-space Ethtool Liang-Min Larry Wang
2015-05-30  0:37 ` [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address Liang-Min Larry Wang
2015-05-30  1:57   ` Andrew Harvey (agh)
2015-05-29 13:15 [dpdk-dev] [PATCH 0/2] User-space Ethtool Liang-Min Larry Wang
2015-05-29 13:15 ` [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address Liang-Min Larry Wang
2015-05-29 15:20   ` Stephen Hemminger
2015-05-29 18:21     ` Wang, Liang-min

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432927612-12244-2-git-send-email-liang-min.wang@intel.com \
    --to=liang-min.wang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).