[dpdk-dev] [PATCH v7 1/3] ethdev: fix adding invalid MAC addr
Thomas Monjalon
thomas at monjalon.net
Fri May 5 16:07:58 CEST 2017
05/05/2017 03:46, Yang, Qiming:
> Hi, Dai wei
>
> > static void
> > diff --git a/drivers/net/e1000/igb_ethdev.c
> > b/drivers/net/e1000/igb_ethdev.c index b6b81cb..e8c6282 100644
> > --- a/drivers/net/e1000/igb_ethdev.c
> > +++ b/drivers/net/e1000/igb_ethdev.c
> > @@ -171,9 +171,9 @@ static int eth_igb_led_off(struct rte_eth_dev *dev);
> >
> > static void igb_intr_disable(struct e1000_hw *hw); static int
> > igb_get_rx_buffer_size(struct e1000_hw *hw);
> > -static void
> > eth_igb_rar_set(struct rte_eth_dev *dev,
> > - struct ether_addr *mac_addr,
> > - uint32_t index, uint32_t pool);
> > +static int eth_igb_rar_set(struct rte_eth_dev *dev,
> > + struct ether_addr *mac_addr,
> > + uint32_t index, uint32_t pool);
> > static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index);
> > static void eth_igb_default_mac_addr_set(struct rte_eth_dev *dev,
> > struct ether_addr *addr);
> > @@ -3079,7 +3079,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev,
> > struct rte_eth_fc_conf *fc_conf) }
> >
> > #define E1000_RAH_POOLSEL_SHIFT (18)
> > -static void
> > +static int
> > eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
> > uint32_t index, __rte_unused uint32_t pool) { @@ -3090,6
> > +3090,7 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr
> > *mac_addr,
> > rah = E1000_READ_REG(hw, E1000_RAH(index));
> > rah |= (0x1 << (E1000_RAH_POOLSEL_SHIFT + pool));
> > E1000_WRITE_REG(hw, E1000_RAH(index), rah);
> > + return 0;
> > }
> What's the meaning to add a return here? Return 0 can't represent adding an invalid or valid address, it's meaningless.
Because
drivers/net/e1000/igb_ethdev.c: .mac_addr_add = eth_igb_rar_set,
and .mac_addr_add is changed to return an error code.
More information about the dev
mailing list