Skip to content

Commit

Permalink
i40e: Clean up of cloud filters
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
anambiarin authored and Jeff Kirsher committed Oct 31, 2017
1 parent 2c00152 commit aaf6650
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ struct i40e_fdir_filter {
u32 fd_id;
};

struct i40e_cloud_filter {
struct hlist_node cloud_node;
unsigned long cookie;
u16 seid; /* filter control */
};

#define I40E_ETH_P_LLDP 0x88cc

#define I40E_DCB_PRIO_TYPE_STRICT 0
Expand Down Expand Up @@ -420,6 +426,9 @@ struct i40e_pf {
struct i40e_udp_port_config udp_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
u16 pending_udp_bitmap;

struct hlist_head cloud_filter_list;
u16 num_cloud_filters;

enum i40e_interrupt_policy int_policy;
u16 rx_itr_default;
u16 tx_itr_default;
Expand Down
24 changes: 24 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6936,6 +6936,26 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)
I40E_L3_SRC_MASK | I40E_L3_DST_MASK);
}

/**
* i40e_cloud_filter_exit - Cleans up the cloud filters
* @pf: Pointer to PF
*
* This function destroys the hlist where all the cloud filters
* were saved.
**/
static void i40e_cloud_filter_exit(struct i40e_pf *pf)
{
struct i40e_cloud_filter *cfilter;
struct hlist_node *node;

hlist_for_each_entry_safe(cfilter, node,
&pf->cloud_filter_list, cloud_node) {
hlist_del(&cfilter->cloud_node);
kfree(cfilter);
}
pf->num_cloud_filters = 0;
}

/**
* i40e_close - Disables a network interface
* @netdev: network interface device structure
Expand Down Expand Up @@ -12196,6 +12216,7 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
vsi = i40e_vsi_reinit_setup(pf->vsi[pf->lan_vsi]);
if (!vsi) {
dev_info(&pf->pdev->dev, "setup of MAIN VSI failed\n");
i40e_cloud_filter_exit(pf);
i40e_fdir_teardown(pf);
return -EAGAIN;
}
Expand Down Expand Up @@ -13030,6 +13051,8 @@ static void i40e_remove(struct pci_dev *pdev)
if (pf->vsi[pf->lan_vsi])
i40e_vsi_release(pf->vsi[pf->lan_vsi]);

i40e_cloud_filter_exit(pf);

/* remove attached clients */
if (pf->flags & I40E_FLAG_IWARP_ENABLED) {
ret_code = i40e_lan_del_device(pf);
Expand Down Expand Up @@ -13261,6 +13284,7 @@ static void i40e_shutdown(struct pci_dev *pdev)

del_timer_sync(&pf->service_timer);
cancel_work_sync(&pf->service_task);
i40e_cloud_filter_exit(pf);
i40e_fdir_teardown(pf);

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

0 comments on commit aaf6650

Please sign in to comment.