Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Amritha Nambiar <amritha.nambiar@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 5/6] [net-next]net: i40e: Clean up of cloud filters
Date: Mon, 31 Jul 2017 17:38:00 -0700	[thread overview]
Message-ID: <150154787996.4135.2478207403613749470.stgit@anamdev.jf.intel.com> (raw)
In-Reply-To: <150154569340.4135.11548126443780491627.stgit@anamdev.jf.intel.com>

Introduce the cloud filter datastructure and cleanup of cloud
filters associated with the device.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h      |   11 +++++++++++
 drivers/net/ethernet/intel/i40e/i40e_main.c |   27 +++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 1391e5d..5c0cad5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -252,6 +252,14 @@ struct i40e_fdir_filter {
 	u32 fd_id;
 };
 
+struct i40e_cloud_filter {
+	struct hlist_node cloud_node;
+	/* cloud filter input set follows */
+	unsigned long cookie;
+	/* filter control */
+	u16 seid;
+};
+
 #define I40E_ETH_P_LLDP			0x88cc
 
 #define I40E_DCB_PRIO_TYPE_STRICT	0
@@ -419,6 +427,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;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index fdddd74..93f6fe2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6928,6 +6928,29 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)
 }
 
 /**
+ * i40e_cloud_filter_exit - Cleans up the Cloud Filters
+ * @pf: Pointer to PF
+ *
+ * This function destroys the hlist where all the Cloud Filters
+ * filters were saved.
+ **/
+static void i40e_cloud_filter_exit(struct i40e_pf *pf)
+{
+	struct i40e_cloud_filter *cfilter;
+	struct hlist_node *node;
+
+	if (hlist_empty(&pf->cloud_filter_list))
+		return;
+
+	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
  *
@@ -12137,6 +12160,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;
 		}
@@ -12961,6 +12985,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);
@@ -13170,6 +13196,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


  parent reply	other threads:[~2017-08-01  0:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  0:36 [Intel-wired-lan] [PATCH net-next RFC 0/6] Configure cloud filters in i40e via tc/flower classifier Amritha Nambiar
2017-08-01  0:37 ` [Intel-wired-lan] [PATCH 1/6] [net-next]net: sched: act_mirred: Extend redirect action to accept a traffic class Amritha Nambiar
2017-08-01 10:22   ` Jamal Hadi Salim
2017-08-02  1:12     ` Nambiar, Amritha
2017-08-01 10:44   ` Jamal Hadi Salim
2017-08-02  1:42     ` Nambiar, Amritha
2017-08-01 11:12   ` Jiri Pirko
2017-08-02  2:20     ` Nambiar, Amritha
2017-08-01  0:37 ` [Intel-wired-lan] [PATCH 2/6] [net-next]net: i40e: Maintain a mapping of TCs with the VSI seids Amritha Nambiar
2017-08-01  0:37 ` [Intel-wired-lan] [PATCH 3/6] [net-next]net: i40e: Extend set switch config command to accept cloud filter mode Amritha Nambiar
2017-08-01 10:48   ` Jamal Hadi Salim
2017-08-01  0:37 ` [Intel-wired-lan] [PATCH 4/6] [net-next]net: i40e: Admin queue definitions for cloud filters Amritha Nambiar
2017-08-01 19:16   ` Shannon Nelson
2017-08-14 18:59     ` Nambiar, Amritha
2017-08-01  0:38 ` Amritha Nambiar [this message]
2017-08-01 19:16   ` [Intel-wired-lan] [PATCH 5/6] [net-next]net: i40e: Clean up of " Shannon Nelson
2017-08-14 19:06     ` Nambiar, Amritha
2017-08-01  0:38 ` [Intel-wired-lan] [PATCH 6/6] [net-next]net: i40e: Enable cloud filters in i40e via tc/flower classifier Amritha Nambiar
2017-08-01 10:56   ` Jamal Hadi Salim
2017-08-02  2:13     ` Nambiar, Amritha
2017-08-02 12:02       ` Jamal Hadi Salim
2017-08-02 18:20         ` Nambiar, Amritha
2017-08-01 19:16   ` Shannon Nelson
2017-08-14 19:21     ` Nambiar, Amritha
2017-08-01 10:15 ` [Intel-wired-lan] [PATCH net-next RFC 0/6] Configure " Jamal Hadi Salim
2017-08-02  0:57   ` Nambiar, Amritha
2017-08-02 12:01     ` Jamal Hadi Salim
2017-08-02 18:17       ` Nambiar, Amritha
2017-08-01 19:16 ` Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150154787996.4135.2478207403613749470.stgit@anamdev.jf.intel.com \
    --to=amritha.nambiar@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox