[dpdk-dev] net/e1000: add mac_addr_set set to em
Checks
Commit Message
From: Chas Williams <chas3@att.com>
Based on the equivalent code in the igb driver.
Signed-off-by: Chas Williams <chas3@att.com>
---
drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
On Mon, Feb 19, 2018 at 1:39 AM, Chas Williams <3chas3@gmail.com> wrote:
> From: Chas Williams <chas3@att.com>
>
> Based on the equivalent code in the igb driver.
>
> Signed-off-by: Chas Williams <chas3@att.com>
> ---
> drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 242375f..5bb9cc9 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -94,6 +94,8 @@ static int em_get_rx_buffer_size(struct e1000_hw *hw);
> static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
> uint32_t index, uint32_t pool);
> static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
> +static void eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> + struct ether_addr *addr);
>
> static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
> struct ether_addr *mc_addr_set,
> @@ -190,6 +192,7 @@ static const struct eth_dev_ops eth_em_ops = {
> .dev_led_off = eth_em_led_off,
> .flow_ctrl_get = eth_em_flow_ctrl_get,
> .flow_ctrl_set = eth_em_flow_ctrl_set,
> + .mac_addr_set = eth_em_default_mac_addr_set,
> .mac_addr_add = eth_em_rar_set,
> .mac_addr_remove = eth_em_rar_clear,
> .set_mc_addr_list = eth_em_set_mc_addr_list,
> @@ -1809,6 +1812,15 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index)
> e1000_rar_set(hw, addr, index);
> }
>
> +static void
> +eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> + struct ether_addr *addr)
> +{
> + eth_em_rar_clear(dev, 0);
> +
> + eth_em_rar_set(dev, (void *)addr, 0, 0);
> +}
> +
Even if copied from igb, this cast is unneeded.
I wrote a similar patch which was in the "upstream" queue, so looks good to me.
Reviewed-by: David Marchand <david.marchand@6wind.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chas Williams
> Sent: Monday, February 19, 2018 8:40 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Chas Williams <chas3@att.com>
> Subject: [dpdk-dev] [PATCH] net/e1000: add mac_addr_set set to em
>
> From: Chas Williams <chas3@att.com>
>
> Based on the equivalent code in the igb driver.
>
> Signed-off-by: Chas Williams <chas3@att.com>
> ---
> drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/e1000/em_ethdev.c
> b/drivers/net/e1000/em_ethdev.c index 242375f..5bb9cc9 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -94,6 +94,8 @@ static int em_get_rx_buffer_size(struct e1000_hw *hw);
> static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr
> *mac_addr,
> uint32_t index, uint32_t pool);
> static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
> +static void eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> + struct ether_addr *addr);
>
> static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
> struct ether_addr *mc_addr_set,
> @@ -190,6 +192,7 @@ static const struct eth_dev_ops eth_em_ops = {
> .dev_led_off = eth_em_led_off,
> .flow_ctrl_get = eth_em_flow_ctrl_get,
> .flow_ctrl_set = eth_em_flow_ctrl_set,
> + .mac_addr_set = eth_em_default_mac_addr_set,
> .mac_addr_add = eth_em_rar_set,
> .mac_addr_remove = eth_em_rar_clear,
> .set_mc_addr_list = eth_em_set_mc_addr_list,
> @@ -1809,6 +1812,15 @@ eth_em_rar_clear(struct rte_eth_dev *dev,
> uint32_t index)
> e1000_rar_set(hw, addr, index);
> }
>
> +static void
> +eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> + struct ether_addr *addr)
> +{
> + eth_em_rar_clear(dev, 0);
> +
> + eth_em_rar_set(dev, (void *)addr, 0, 0); }
> +
> static int
> eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> --
> 2.9.5
I think this patch is need by em to enable the feature of configuration for
default Receive Address Register, if DPDK user use rte function of
rte_eth_dev_default_mac_addr_set(), it can do this config work like other NIC.
Acked-by: Wei Zhao <wei.zhao1@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhao1, Wei
> Sent: Monday, April 2, 2018 2:17 PM
> To: Chas Williams; dev@dpdk.org
> Cc: Lu, Wenzhuo; Chas Williams
> Subject: Re: [dpdk-dev] [PATCH] net/e1000: add mac_addr_set set to em
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chas Williams
> > Sent: Monday, February 19, 2018 8:40 AM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Chas Williams <chas3@att.com>
> > Subject: [dpdk-dev] [PATCH] net/e1000: add mac_addr_set set to em
> >
> > From: Chas Williams <chas3@att.com>
> >
> > Based on the equivalent code in the igb driver.
> >
> > Signed-off-by: Chas Williams <chas3@att.com>
> > ---
> > drivers/net/e1000/em_ethdev.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/net/e1000/em_ethdev.c
> > b/drivers/net/e1000/em_ethdev.c index 242375f..5bb9cc9 100644
> > --- a/drivers/net/e1000/em_ethdev.c
> > +++ b/drivers/net/e1000/em_ethdev.c
> > @@ -94,6 +94,8 @@ static int em_get_rx_buffer_size(struct e1000_hw
> > *hw); static int eth_em_rar_set(struct rte_eth_dev *dev, struct
> > ether_addr *mac_addr,
> > uint32_t index, uint32_t pool);
> > static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t
> > index);
> > +static void eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> > + struct ether_addr *addr);
> >
> > static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
> > struct ether_addr *mc_addr_set, @@ -190,6
> +192,7 @@ static
> > const struct eth_dev_ops eth_em_ops = {
> > .dev_led_off = eth_em_led_off,
> > .flow_ctrl_get = eth_em_flow_ctrl_get,
> > .flow_ctrl_set = eth_em_flow_ctrl_set,
> > + .mac_addr_set = eth_em_default_mac_addr_set,
> > .mac_addr_add = eth_em_rar_set,
> > .mac_addr_remove = eth_em_rar_clear,
> > .set_mc_addr_list = eth_em_set_mc_addr_list,
> > @@ -1809,6 +1812,15 @@ eth_em_rar_clear(struct rte_eth_dev *dev,
> > uint32_t index)
> > e1000_rar_set(hw, addr, index);
> > }
> >
> > +static void
> > +eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
> > + struct ether_addr *addr)
> > +{
> > + eth_em_rar_clear(dev, 0);
> > +
> > + eth_em_rar_set(dev, (void *)addr, 0, 0); }
> > +
> > static int
> > eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) {
> > --
> > 2.9.5
>
>
> I think this patch is need by em to enable the feature of configuration for
> default Receive Address Register, if DPDK user use rte function of
> rte_eth_dev_default_mac_addr_set(), it can do this config work like other NIC.
>
> Acked-by: Wei Zhao <wei.zhao1@intel.com>
Applied to dpdk-next-net-intel, thanks!
/Helin
@@ -94,6 +94,8 @@ static int em_get_rx_buffer_size(struct e1000_hw *hw);
static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
uint32_t index, uint32_t pool);
static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
+static void eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
+ struct ether_addr *addr);
static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
struct ether_addr *mc_addr_set,
@@ -190,6 +192,7 @@ static const struct eth_dev_ops eth_em_ops = {
.dev_led_off = eth_em_led_off,
.flow_ctrl_get = eth_em_flow_ctrl_get,
.flow_ctrl_set = eth_em_flow_ctrl_set,
+ .mac_addr_set = eth_em_default_mac_addr_set,
.mac_addr_add = eth_em_rar_set,
.mac_addr_remove = eth_em_rar_clear,
.set_mc_addr_list = eth_em_set_mc_addr_list,
@@ -1809,6 +1812,15 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index)
e1000_rar_set(hw, addr, index);
}
+static void
+eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
+ struct ether_addr *addr)
+{
+ eth_em_rar_clear(dev, 0);
+
+ eth_em_rar_set(dev, (void *)addr, 0, 0);
+}
+
static int
eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
{