[dpdk-dev] [PATCH v2 04/17] net/i40e: restore ethertype filter

Wu, Jingjing jingjing.wu at intel.com
Wed Dec 28 03:25:16 CET 2016



> -----Original Message-----
> From: Xing, Beilei
> Sent: Tuesday, December 27, 2016 2:26 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>; Zhang, Helin <helin.zhang at intel.com>
> Cc: dev at dpdk.org
> Subject: [PATCH v2 04/17] net/i40e: restore ethertype filter
> 
> Add support of restoring ethertype filter in case filter dropped accidentally, as all
> filters need to be added and removed by user obviously for generic filter API.
> 
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 39
> +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 427ebdc..cd7c309 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -484,6 +484,9 @@ static int i40e_sw_tunnel_filter_insert(struct i40e_pf *pf,
> static int i40e_sw_tunnel_filter_del(struct i40e_pf *pf,
>  			     struct i40e_tunnel_filter *tunnel_filter);
> 
> +static void i40e_ethertype_filter_restore(struct i40e_pf *pf); static
> +void i40e_filter_restore(struct i40e_pf *pf);
> +
>  static const struct rte_pci_id pci_id_i40e_map[] = {
>  	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) },
>  	{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) },
> @@ -1964,6 +1967,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
>  	/* enable uio intr after callback register */
>  	rte_intr_enable(intr_handle);
> 
> +	i40e_filter_restore(pf);
> +
>  	return I40E_SUCCESS;
> 
>  err_up:
> @@ -10066,3 +10071,37 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
> 
>  	return ret;
>  }
> +
> +/* Restore ethertype filter */
> +static void
> +i40e_ethertype_filter_restore(struct i40e_pf *pf) {
> +	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
> +	struct i40e_ethertype_filter_list
> +		*ethertype_list = &pf->ethertype.ethertype_list;
> +	struct i40e_ethertype_filter *f;
> +	struct i40e_control_filter_stats stats;
> +	uint16_t flags;
> +
> +	TAILQ_FOREACH(f, ethertype_list, rules) {
> +		flags = 0;
> +		if (!(f->flags & RTE_ETHTYPE_FLAGS_MAC))
> +			flags |=
> I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC;
> +		if (f->flags & RTE_ETHTYPE_FLAGS_DROP)
> +			flags |=
> I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP;
> +		flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE;
> +
> +		memset(&stats, 0, sizeof(stats));
> +		i40e_aq_add_rem_control_packet_filter(hw,
> +					    f->input.mac_addr.addr_bytes,
> +					    f->input.ether_type,
> +					    flags, pf->main_vsi->seid,
> +					    f->queue, 1, &stats, NULL);
> +	}
How about to lig the stats to show how many filters are restored?


Thanks
Jingjing


More information about the dev mailing list