[dpdk-dev] net/null: add set MAC address dev op

Message ID 1517235632-24080-1-git-send-email-radu.nicolau@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Radu Nicolau Jan. 29, 2018, 2:20 p.m. UTC
  Needed if used with net/bonding

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/null/rte_eth_null.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Ferruh Yigit Jan. 31, 2018, 7:18 p.m. UTC | #1
On 1/29/2018 2:20 PM, Radu Nicolau wrote:
> Needed if used with net/bonding
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  drivers/net/null/rte_eth_null.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 7cd5c71..511e2b7 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -456,6 +456,12 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev,
>  	return 0;
>  }
>  
> +static void
> +eth_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr)
> +{
> +	memcpy(dev->data->mac_addrs, addr, sizeof(struct ether_addr));

This copy already done in ethdev layer, an empty function will do the work.

> +}
> +
>  static const struct eth_dev_ops ops = {
>  	.dev_start = eth_dev_start,
>  	.dev_stop = eth_dev_stop,
> @@ -466,6 +472,7 @@ static const struct eth_dev_ops ops = {
>  	.rx_queue_release = eth_queue_release,
>  	.tx_queue_release = eth_queue_release,
>  	.link_update = eth_link_update,
> +	.mac_addr_set = eth_mac_address_set,
>  	.stats_get = eth_stats_get,
>  	.stats_reset = eth_stats_reset,
>  	.reta_update = eth_rss_reta_update,
>
  

Patch

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 7cd5c71..511e2b7 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -456,6 +456,12 @@  eth_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static void
+eth_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr)
+{
+	memcpy(dev->data->mac_addrs, addr, sizeof(struct ether_addr));
+}
+
 static const struct eth_dev_ops ops = {
 	.dev_start = eth_dev_start,
 	.dev_stop = eth_dev_stop,
@@ -466,6 +472,7 @@  static const struct eth_dev_ops ops = {
 	.rx_queue_release = eth_queue_release,
 	.tx_queue_release = eth_queue_release,
 	.link_update = eth_link_update,
+	.mac_addr_set = eth_mac_address_set,
 	.stats_get = eth_stats_get,
 	.stats_reset = eth_stats_reset,
 	.reta_update = eth_rss_reta_update,