Skip to content

Commit 18c908e

Browse files
Maor Gottliebdavem330
authored andcommitted
net/mlx5e: Add accelerated RFS support
Implement ndo_rx_flow_steer ndo. A new flow steering rule will be composed from the skb 4-tuple and added to the hardware aRFS flow table. Each rule is stored in an internal hash table, if such skb 4-tuple rule already exists we update the corresponding hardware steering rule with the new destination. For garbage collection rps_may_expire_flow will be invoked for a limited amount of old rules upon any ndo_rx_flow_steer invocation. Signed-off-by: Maor Gottlieb <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1cabe6b commit 18c908e

File tree

2 files changed

+436
-1
lines changed

2 files changed

+436
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,12 @@ struct mlx5e_ttc_table {
448448
struct mlx5_flow_rule *rules[MLX5E_NUM_TT];
449449
};
450450

451+
#define ARFS_HASH_SHIFT BITS_PER_BYTE
452+
#define ARFS_HASH_SIZE BIT(BITS_PER_BYTE)
451453
struct arfs_table {
452454
struct mlx5e_flow_table ft;
453455
struct mlx5_flow_rule *default_rule;
456+
struct hlist_head rules_hash[ARFS_HASH_SIZE];
454457
};
455458

456459
enum arfs_type {
@@ -463,6 +466,11 @@ enum arfs_type {
463466

464467
struct mlx5e_arfs_tables {
465468
struct arfs_table arfs_tables[ARFS_NUM_TYPES];
469+
/* Protect aRFS rules list */
470+
spinlock_t arfs_lock;
471+
struct list_head rules;
472+
int last_filter_id;
473+
struct workqueue_struct *wq;
466474
};
467475

468476
/* NIC prio FTS */
@@ -685,6 +693,8 @@ static inline void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) {}
685693
#else
686694
int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
687695
void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv);
696+
int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
697+
u16 rxq_index, u32 flow_id);
688698
#endif
689699

690700
u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);

0 commit comments

Comments
 (0)