Skip to content

Commit aaf6650

Browse files
anambiarinJeff Kirsher
authored andcommitted
i40e: Clean up of cloud filters
Introduce the cloud filter data structure and cleanup of cloud filters associated with the device. Signed-off-by: Amritha Nambiar <[email protected]> Acked-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 2c00152 commit aaf6650

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ struct i40e_fdir_filter {
253253
u32 fd_id;
254254
};
255255

256+
struct i40e_cloud_filter {
257+
struct hlist_node cloud_node;
258+
unsigned long cookie;
259+
u16 seid; /* filter control */
260+
};
261+
256262
#define I40E_ETH_P_LLDP 0x88cc
257263

258264
#define I40E_DCB_PRIO_TYPE_STRICT 0
@@ -420,6 +426,9 @@ struct i40e_pf {
420426
struct i40e_udp_port_config udp_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
421427
u16 pending_udp_bitmap;
422428

429+
struct hlist_head cloud_filter_list;
430+
u16 num_cloud_filters;
431+
423432
enum i40e_interrupt_policy int_policy;
424433
u16 rx_itr_default;
425434
u16 tx_itr_default;

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6936,6 +6936,26 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)
69366936
I40E_L3_SRC_MASK | I40E_L3_DST_MASK);
69376937
}
69386938

6939+
/**
6940+
* i40e_cloud_filter_exit - Cleans up the cloud filters
6941+
* @pf: Pointer to PF
6942+
*
6943+
* This function destroys the hlist where all the cloud filters
6944+
* were saved.
6945+
**/
6946+
static void i40e_cloud_filter_exit(struct i40e_pf *pf)
6947+
{
6948+
struct i40e_cloud_filter *cfilter;
6949+
struct hlist_node *node;
6950+
6951+
hlist_for_each_entry_safe(cfilter, node,
6952+
&pf->cloud_filter_list, cloud_node) {
6953+
hlist_del(&cfilter->cloud_node);
6954+
kfree(cfilter);
6955+
}
6956+
pf->num_cloud_filters = 0;
6957+
}
6958+
69396959
/**
69406960
* i40e_close - Disables a network interface
69416961
* @netdev: network interface device structure
@@ -12196,6 +12216,7 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
1219612216
vsi = i40e_vsi_reinit_setup(pf->vsi[pf->lan_vsi]);
1219712217
if (!vsi) {
1219812218
dev_info(&pf->pdev->dev, "setup of MAIN VSI failed\n");
12219+
i40e_cloud_filter_exit(pf);
1219912220
i40e_fdir_teardown(pf);
1220012221
return -EAGAIN;
1220112222
}
@@ -13030,6 +13051,8 @@ static void i40e_remove(struct pci_dev *pdev)
1303013051
if (pf->vsi[pf->lan_vsi])
1303113052
i40e_vsi_release(pf->vsi[pf->lan_vsi]);
1303213053

13054+
i40e_cloud_filter_exit(pf);
13055+
1303313056
/* remove attached clients */
1303413057
if (pf->flags & I40E_FLAG_IWARP_ENABLED) {
1303513058
ret_code = i40e_lan_del_device(pf);
@@ -13261,6 +13284,7 @@ static void i40e_shutdown(struct pci_dev *pdev)
1326113284

1326213285
del_timer_sync(&pf->service_timer);
1326313286
cancel_work_sync(&pf->service_task);
13287+
i40e_cloud_filter_exit(pf);
1326413288
i40e_fdir_teardown(pf);
1326513289

1326613290
/* Client close must be called explicitly here because the timer

0 commit comments

Comments
 (0)