[dpdk-dev] [PATCH 06/22] net/hns3: add support for MAC address related operations

Wei Hu (Xavier) xavier.huwei at huawei.com
Thu Sep 5 07:40:57 CEST 2019


Hi, Ferruh Yigit


On 2019/8/30 23:03, Ferruh Yigit wrote:
> On 8/23/2019 2:46 PM, Wei Hu (Xavier) wrote:
>> This patch adds the following mac address related operations defined in
>> struct eth_dev_ops: mac_addr_add, mac_addr_remove, mac_addr_set
>> and set_mc_addr_list.
>>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
>> Signed-off-by: Chunsong Feng <fengchunsong at huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
>> Signed-off-by: Hao Chen <chenhao164 at huawei.com>
>> Signed-off-by: Huisong Li <lihuisong at huawei.com>
> <...>
>
>> +static int
>> +hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev,
>> +			  struct rte_ether_addr *mc_addr_set,
>> +			  uint32_t nb_mc_addr)
>> +{
>> +	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>> +	struct rte_ether_addr reserved_addr_list[HNS3_MC_MACADDR_NUM];
>> +	struct rte_ether_addr add_addr_list[HNS3_MC_MACADDR_NUM];
>> +	struct rte_ether_addr rm_addr_list[HNS3_MC_MACADDR_NUM];
>> +	struct rte_ether_addr *addr;
>> +	int reserved_addr_num;
>> +	int add_addr_num;
>> +	int rm_addr_num;
>> +	int mc_addr_num;
>> +	int num;
>> +	int ret;
>> +	int i;
>> +
>> +	/* Check if input parameters are valid */
>> +	ret = hns3_set_mc_addr_chk_param(hw, mc_addr_set, nb_mc_addr);
>> +	if (ret)
>> +		return ret;
>> +
>> +	rte_spinlock_lock(&hw->lock);
> Is locking required here?
We support reset after exception, and restore the settings to the
pre-reset by the alarm in the interrupt thread. There are two threads
setting mc_mac, so we need to lock.
>
> <...>
>
>> @@ -1582,6 +2394,10 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
>>  
>>  static const struct eth_dev_ops hns3_eth_dev_ops = {
>>  	.dev_close          = hns3_dev_close,
>> +	.mac_addr_add           = hns3_add_mac_addr,
>> +	.mac_addr_remove        = hns3_remove_mac_addr,
>> +	.mac_addr_set           = hns3_set_default_mac_addr,
>> +	.set_mc_addr_list       = hns3_set_mc_mac_addr_list,
>>  };
> Can you please update .ini file in this patch and mark following features as
> supported:
> Unicast MAC filter
> Multicast MAC filter
OK, we will fix it in v2.

    Best Regards
Xavier
>




More information about the dev mailing list