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 <[email protected]>
> ---
> 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.