Thread (69 messages) 69 messages, 5 authors, 2019-08-09

Re: [PATCH v4 net-next 10/19] ionic: Add management of rx filters

From: Saeed Mahameed <hidden>
Date: 2019-07-24 23:52:43

On Mon, 2019-07-22 at 14:40 -0700, Shannon Nelson wrote:
Set up the infrastructure for managing Rx filters.  We can't ask the
hardware for what filters it has, so we keep a local list of filters
that we've pushed into the HW.

Signed-off-by: Shannon Nelson <redacted>
---
 drivers/net/ethernet/pensando/ionic/Makefile  |   4 +-
 .../net/ethernet/pensando/ionic/ionic_lif.c   |   6 +
 .../net/ethernet/pensando/ionic/ionic_lif.h   |   2 +
 .../ethernet/pensando/ionic/ionic_rx_filter.c | 143
++++++++++++++++++
 .../ethernet/pensando/ionic/ionic_rx_filter.h |  35 +++++
 5 files changed, 188 insertions(+), 2 deletions(-)
 create mode 100644
drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
 create mode 100644
drivers/net/ethernet/pensando/ionic/ionic_rx_filter.h
[...]
+#define RXQ_INDEX_ANY		(0xFFFF)
+struct rx_filter {
+	u32 flow_id;
+	u32 filter_id;
+	u16 rxq_index;
+	struct rx_filter_add_cmd cmd;
+	struct hlist_node by_hash;
+	struct hlist_node by_id;
+};
+
+#define RX_FILTER_HASH_BITS	10
+#define RX_FILTER_HLISTS	BIT(RX_FILTER_HASH_BITS)
+#define RX_FILTER_HLISTS_MASK	(RX_FILTER_HLISTS - 1)
+struct rx_filters {
+	spinlock_t lock;				/* filter list lock
*/
+	struct hlist_head by_hash[RX_FILTER_HLISTS];	/* by skb
hash */
+	struct hlist_head by_id[RX_FILTER_HLISTS];	/* by
filter_id */
+};
+
Following Dave's comment on this, you use too generic struct and macro
/define names, i strongly recommend to add a unique prefix to this
driver.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help