mlx5 updates 2021-04-02
Subsystems (6)
From: Saeed Mahameed <[email protected]>
Hi Dave, Jakub,
This series provfides misc updates to mlx5.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit bd78980be1a68d14524c51c4b4170782fada622b:
net: usb: ax88179_178a: initialize local variables before use (2021-04-01 16:09:37 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-04-02
for you to fetch changes up to 6783f0a21a3ce60e2ac9e56814afcbb01f98cc2e:
net/mlx5e: Dynamic alloc vlan table for netdev when needed (2021-04-02 16:13:08 -0700)
----------------------------------------------------------------
mlx5-updates-2021-04-02
This series provides trivial updates and cleanup to mlx5 driver
1) Support for matching on ct_state inv and rel flag in connection tracking
2) Reject TC rules that redirect from a VF to itself
3) Parav provided some E-Switch cleanups that could be summarized to:
3.1) Packing and Reduce structure sizes
3.2) Dynamic allocation of rate limit tables and structures
4) Vu Makes the netdev arfs and vlan tables allocation dynamic.
----------------------------------------------------------------
Ariel Levkovich (2):
net/mlx5: CT: Add support for matching on ct_state inv and rel flags net/mlx5e: Reject tc rules which redirect from a VF to itself
Parav Pandit (11):
net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes net/mlx5: E-Switch, move QoS specific fields to existing qos struct net/mlx5: Use unsigned int for free_count
net/mlx5: Pack mlx5_rl_entry structure
net/mlx5: Do not hold mutex while reading table constants net/mlx5: Use helpers to allocate and free rl table entries net/mlx5: Use helper to increment, decrement rate entry refcount net/mlx5: Allocate rate limit table when rate is configured net/mlx5: Pair mutex_destory with mutex_init for rate limit table net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes net/mlx5: E-Switch, move QoS specific fields to existing qos struct
Roi Dayan (1):
net/mlx5: Use ida_alloc_range() instead of ida_simple_alloc()
Vu Pham (2):
net/mlx5e: Dynamic alloc arfs table for netdev when needed net/mlx5e: Dynamic alloc vlan table for netdev when needed
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h | 46 ++----- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 26 +++- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 95 +++++++++----- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 132 +++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 17 ++- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 26 ++-- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 10 +- .../net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/lib/gid.c | 10 +- .../net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 139 ++++++++++++++------- include/linux/mlx5/driver.h | 3 +- 14 files changed, 323 insertions(+), 198 deletions(-)
PATCH 1/16 net/mlx5: CT: Add support for matching on ct_state inv and rel flags
From: Ariel Levkovich <[email protected]>
Add support for matching on ct_state inv and rel flags.
Currently the support is only for match on -inv and -rel. Matching on +inv and +rel will be rejected.
Example:
$ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \ ct_state -est-rel+trk \ action mirred egress redirect dev ens1f0_1 $ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \ ct_state +trk+est-inv \ action mirred egress redirect dev ens1f0_0
--- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +24 -2
@@ -29,6 +29,8 @@#define MLX5_CT_STATE_TRK_BIT BIT(2)#define MLX5_CT_STATE_NAT_BIT BIT(3)#define MLX5_CT_STATE_REPLY_BIT BIT(4) +#define MLX5_CT_STATE_RELATED_BIT BIT(5) +#define MLX5_CT_STATE_INVALID_BIT BIT(6)#define MLX5_FTE_ID_BITS (mlx5e_tc_attr_to_reg_mappings[FTEID_TO_REG].mlen * 8)#define MLX5_FTE_ID_MAX GENMASK(MLX5_FTE_ID_BITS - 1, 0)
@@ -1207,8 +1209,8 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,struct mlx5_ct_attr *ct_attr, struct netlink_ext_ack *extack) { + bool trk, est, untrk, unest, new, rpl, unrpl, rel, unrel, inv, uninv;struct flow_rule *rule =flow_cls_offload_flow_rule (f); -bool trk, est, untrk, unest, new, rpl, unrpl;struct flow_dissector_key_ct *mask, *key;u32 ctstate =0 , ctstate_mask =0 ;u16 ct_state_on, ct_state_off;
@@ -1236,7 +1238,9 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,if (ct_state_mask & ~(TCA_FLOWER_KEY_CT_FLAGS_TRACKED |TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED |TCA_FLOWER_KEY_CT_FLAGS_NEW | -TCA_FLOWER_KEY_CT_FLAGS_REPLY )) { +TCA_FLOWER_KEY_CT_FLAGS_REPLY | +TCA_FLOWER_KEY_CT_FLAGS_RELATED | +TCA_FLOWER_KEY_CT_FLAGS_INVALID )) {NL_SET_ERR_MSG_MOD (extack,"only ct_state trk, est, new and rpl are supported for offload" );return -EOPNOTSUPP ;
@@ -1248,9 +1252,13 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv, new = ct_state_on &TCA_FLOWER_KEY_CT_FLAGS_NEW ; est = ct_state_on &TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED ; rpl = ct_state_on &TCA_FLOWER_KEY_CT_FLAGS_REPLY ; + rel = ct_state_on &TCA_FLOWER_KEY_CT_FLAGS_RELATED ; + inv = ct_state_on &TCA_FLOWER_KEY_CT_FLAGS_INVALID ; untrk = ct_state_off &TCA_FLOWER_KEY_CT_FLAGS_TRACKED ; unest = ct_state_off &TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED ; unrpl = ct_state_off &TCA_FLOWER_KEY_CT_FLAGS_REPLY ; + unrel = ct_state_off &TCA_FLOWER_KEY_CT_FLAGS_RELATED ; + uninv = ct_state_off &TCA_FLOWER_KEY_CT_FLAGS_INVALID ; ctstate |= trk ?MLX5_CT_STATE_TRK_BIT :0 ; ctstate |= est ?MLX5_CT_STATE_ESTABLISHED_BIT :0 ;
@@ -1258,6 +1266,20 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv, ctstate_mask |= (untrk || trk) ?MLX5_CT_STATE_TRK_BIT :0 ; ctstate_mask |= (unest || est) ?MLX5_CT_STATE_ESTABLISHED_BIT :0 ; ctstate_mask |= (unrpl || rpl) ?MLX5_CT_STATE_REPLY_BIT :0 ; + ctstate_mask |= unrel ?MLX5_CT_STATE_RELATED_BIT :0 ; + ctstate_mask |= uninv ?MLX5_CT_STATE_INVALID_BIT :0 ; + +if (rel) { +NL_SET_ERR_MSG_MOD (extack, +"matching on ct_state +rel isn't supported" ); +return -EOPNOTSUPP ; + } + +if (inv) { +NL_SET_ERR_MSG_MOD (extack, +"matching on ct_state +inv isn't supported" ); +return -EOPNOTSUPP ; + }if (new) { NL_SET_ERR_MSG_MOD(extack,
Signature · 1 line
2.30.2
Re: [net-next 01/16] net/mlx5: CT: Add support for matching on ct_state inv and rel flags
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 8 lines · On Sat, 3 Apr 2021 21:19:39 -0700 you wrote:
From: Ariel Levkovich <[email protected]>
Add support for matching on
ct_stateinv and rel flags.Currently the support is only for match on -inv and -rel. Matching on +inv and +rel will be rejected.
[...]
Here is the summary with links:
- [net-next,01/16] net/mlx5: CT: Add support for matching on ct_state inv and rel flags
https://git.kernel.org/netdev/net-next/c/116c76c51035 - [net-next,02/16] net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes https://git.kernel.org/netdev/net-next/c/cadb129ffdfe - [net-next,03/16] net/mlx5: E-Switch, move QoS specific fields to existing qos struct https://git.kernel.org/netdev/net-next/c/e591605f801e - [net-next,04/16] net/mlx5: Use unsigned int for free_count https://git.kernel.org/netdev/net-next/c/c6baac47d9e6 - [net-next,05/16] net/mlx5: Pack mlx5_rl_entry structure https://git.kernel.org/netdev/net-next/c/4c4c0a89abd5 - [net-next,06/16] net/mlx5: Do not hold mutex while reading table constants https://git.kernel.org/netdev/net-next/c/16e74672a21b - [net-next,07/16] net/mlx5: Use helpers to allocate and free rl table entries https://git.kernel.org/netdev/net-next/c/51ccc9f5f106 - [net-next,08/16] net/mlx5: Use helper to increment, decrement rate entry refcount https://git.kernel.org/netdev/net-next/c/97d85aba2543 - [net-next,09/16] net/mlx5: Allocate rate limit table when rate is configured https://git.kernel.org/netdev/net-next/c/6b30b6d4d36c - [net-next,10/16] net/mlx5: Pair mutex_destory with mutex_init for rate limit table https://git.kernel.org/netdev/net-next/c/19779f28c96d - [net-next,11/16] net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes https://git.kernel.org/netdev/net-next/c/b47e1056257c - [net-next,12/16] net/mlx5: E-Switch, move QoS specific fields to existing qos struct https://git.kernel.org/netdev/net-next/c/233dd7d6565e - [net-next,13/16] net/mlx5: Use ida_alloc_range() instead of ida_simple_alloc() https://git.kernel.org/netdev/net-next/c/8802b8a44ef8 - [net-next,14/16] net/mlx5e: Reject tc rules which redirect from a VF to itself https://git.kernel.org/netdev/net-next/c/bb5696570b0b - [net-next,15/16] net/mlx5e: Dynamic alloc arfs table for netdev when needed https://git.kernel.org/netdev/net-next/c/f6755b80d693 - [net-next,16/16] net/mlx5e: Dynamic alloc vlan table for netdev when needed https://git.kernel.org/netdev/net-next/c/6783f0a21a3c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/16 net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Structure mlx5_vport_info consumes 40 bytes of space due to a hole in it. After packing it reduces to 32 bytes.
Currently:
pahole -C mlx5_vport_info drivers/net/ethernet/mellanox/mlx5/core/eswitch.o struct mlx5_vport_info {
u8 mac[6]; /* 0 6 */
u16 vlan; /* 6 2 */
u8 qos; /* 8 1 *//* XXX 7 bytes hole, try to pack */
u64 node_guid; /* 16 8 */
int link_state; /* 24 4 */
u32 min_rate; /* 28 4 */
u32 max_rate; /* 32 4 */
bool spoofchk; /* 36 1 */
bool trusted; /* 37 1 */
/* size: 40, cachelines: 1, members: 9 */ /* sum members: 31, holes: 1, sum holes: 7 */ /* padding: 2 */
/* last cacheline: 40 bytes */
};
After packing:
$ pahole -C mlx5_vport_info drivers/net/ethernet/mellanox/mlx5/core/eswitch.o
struct mlx5_vport_info {
u8 mac[6]; /* 0 6 */
u16 vlan; /* 6 2 */
u64 node_guid; /* 8 8 */
int link_state; /* 16 4 */
u32 min_rate; /* 20 4 */
u32 max_rate; /* 24 4 */
u8 qos; /* 28 1 */
u8 spoofchk:1; /* 29: 0 1 */
u8 trusted:1; /* 29: 1 1 */ /* size: 32, cachelines: 1, members: 9 */
/* padding: 2 */
/* bit_padding: 6 bits */
/* last cacheline: 32 bytes */
};--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +3 -3
@@ -118,13 +118,13 @@ struct mlx5_vport_drop_stats {struct mlx5_vport_info {u8 mac[ETH_ALEN ];u16 vlan; -u8 qos;u64 node_guid;int link_state;u32 min_rate;u32 max_rate; -bool spoofchk; -bool trusted; +u8 qos; +u8 spoofchk:1 ; +u8 trusted:1 ; };/* Vport context events */
Signature · 1 line
2.30.2
PATCH 3/16 net/mlx5: E-Switch, move QoS specific fields to existing qos struct
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Function QoS related fields are already defined in qos related struct. min and max rate are left out to mlx5_vport_info struct.
Move them to existing qos struct.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 26 +++++++++---------- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 4 +-- 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +13 -13
@@ -1235,7 +1235,7 @@ static int esw_vport_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)return err;/* Attach vport to the eswitch rate limiter */ -esw_vport_enable_qos (esw, vport, vport->info.max_rate, vport->qos.bw_share); +esw_vport_enable_qos (esw, vport, vport->qos.max_rate, vport->qos.bw_share);if (mlx5_esw_is_manager_vport (esw, vport_num))return 0 ;
@@ -2078,8 +2078,8 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw, ivi->qos = evport->info.qos; ivi->spoofchk = evport->info.spoofchk; ivi->trusted = evport->info.trusted; - ivi->min_tx_rate = evport->info.min_rate; - ivi->max_tx_rate = evport->info.max_rate; + ivi->min_tx_rate = evport->qos.min_rate; + ivi->max_tx_rate = evport->qos.max_rate;mutex_unlock (&esw->state_lock);return 0 ;
@@ -2319,9 +2319,9 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw)int i; mlx5_esw_for_all_vports(esw, i, evport) { -if (!evport->enabled || evport->info.min_rate < max_guarantee) +if (!evport->enabled || evport->qos.min_rate < max_guarantee)continue ; - max_guarantee = evport->info.min_rate; + max_guarantee = evport->qos.min_rate; }if (max_guarantee)
@@ -2343,8 +2343,8 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw) mlx5_esw_for_all_vports(esw, i, evport) {if (!evport->enabled)continue ; - vport_min_rate = evport->info.min_rate; - vport_max_rate = evport->info.max_rate; + vport_min_rate = evport->qos.min_rate; + vport_max_rate = evport->qos.max_rate; bw_share =0 ;if (divider)
@@ -2391,24 +2391,24 @@ int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,mutex_lock (&esw->state_lock); -if (min_rate == evport->info.min_rate) +if (min_rate == evport->qos.min_rate) goto set_max_rate; - previous_min_rate = evport->info.min_rate; - evport->info.min_rate = min_rate; + previous_min_rate = evport->qos.min_rate; + evport->qos.min_rate = min_rate; err =normalize_vports_min_rate (esw);if (err) { - evport->info.min_rate = previous_min_rate; + evport->qos.min_rate = previous_min_rate; goto unlock; } set_max_rate: -if (max_rate == evport->info.max_rate) +if (max_rate == evport->qos.max_rate) goto unlock; err =esw_vport_qos_config (esw, evport, max_rate, evport->qos.bw_share);if (!err) - evport->info.max_rate = max_rate; + evport->qos.max_rate = max_rate; unlock:mutex_unlock (&esw->state_lock);
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +2 -2
@@ -120,8 +120,6 @@ struct mlx5_vport_info {u16 vlan;u64 node_guid;int link_state; -u32 min_rate; -u32 max_rate;u8 qos; u8 spoofchk: 1; u8 trusted: 1;
@@ -154,6 +152,8 @@ struct mlx5_vport {bool enabled;u32 esw_tsar_ix;u32 bw_share; +u32 min_rate; +u32 max_rate; } qos;bool enabled;
Signature · 1 line
2.30.2
PATCH 4/16 net/mlx5: Use unsigned int for free_count
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Fix the warning due to missing int.
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
+ unsigned free_count;
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -1
@@ -61,7 +61,7 @@ struct fw_page {u32 function;unsigned long bitmask;struct list_head list; -unsigned free_count; +unsigned int free_count; };enum {
Signature · 1 line
2.30.2
PATCH 5/16 net/mlx5: Pack mlx5_rl_entry structure
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
mlx5_rl_entry structure is not properly packed as shown below. Due to this an array of size 9144 bytes allocated which is aligned to 16Kbytes. Hence, pack the structure and avoid the wastage.
This offers 8Kbytes of saving per mlx5_core_dev struct.
pahole -C mlx5_rl_entry drivers/net/ethernet/mellanox/mlx5/core/en_main.o
Existing layout:
struct mlx5_rl_entry {
u8 rl_raw[48]; /* 0 48 */
u16 index; /* 48 2 */
/* XXX 6 bytes hole, try to pack */
u64 refcount; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
u16 uid; /* 64 2 */
u8 dedicated:1; /* 66: 0 1 */
/* size: 72, cachelines: 2, members: 5 */
/* sum members: 60, holes: 1, sum holes: 6 */
/* sum bitfield members: 1 bits (0 bytes) */
/* padding: 5 */
/* bit_padding: 7 bits */
/* last cacheline: 8 bytes */
};After alignment:
struct mlx5_rl_entry {
u8 rl_raw[48]; /* 0 48 */
u64 refcount; /* 48 8 */
u16 index; /* 56 2 */
u16 uid; /* 58 2 */
u8 dedicated:1; /* 60: 0 1 */ /* size: 64, cachelines: 1, members: 5 */
/* padding: 3 */
/* bit_padding: 7 bits */
};--- include/linux/mlx5/driver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mlx5/driver.h +1 -1
@@ -517,8 +517,8 @@ struct mlx5_rate_limit {struct mlx5_rl_entry {u8 rl_raw[MLX5_ST_SZ_BYTES (set_pp_rate_limit_context)]; -u16 index;u64 refcount; +u16 index;u16 uid;u8 dedicated :1 ; };
Signature · 1 line
2.30.2
PATCH 6/16 net/mlx5: Do not hold mutex while reading table constants
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Table max_size, min and max rate are constants initialized while table is created. Reading it doesn't need to hold a table mutex. Hence, read them without holding table mutex.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +6 -4
@@ -180,16 +180,18 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid,int err =0 ;u32 rate; - rate =MLX5_GET (set_pp_rate_limit_context, rl_in, rate_limit); -mutex_lock (&table->rl_lock); +if (!table->max_size) +return -EOPNOTSUPP ; + rate =MLX5_GET (set_pp_rate_limit_context, rl_in, rate_limit);if (!rate || !mlx5_rl_is_in_range (dev, rate)) {mlx5_core_err (dev,"Invalid rate: %u, should be %u to %u\n" , rate, table->min_rate, table->max_rate); - err = -EINVAL ; - goto out; +return -EINVAL ; } +mutex_lock (&table->rl_lock); + entry =find_rl_entry (table, rl_in, uid, dedicated_entry);if (!entry) { mlx5_core_err(dev, "Max number of %u rates reached\n",
Signature · 1 line
2.30.2
PATCH 7/16 net/mlx5: Use helpers to allocate and free rl table entries
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
User helper routines to allocate and free rate limit table entries. Subsequent patch extends use of these helpers to do allocation during rate entry allocation callback.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 55 +++++++++++++------- 1 file changed, 36 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +36 -19
@@ -172,6 +172,35 @@ bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0, }EXPORT_SYMBOL (mlx5_rl_are_equal); +static int mlx5_rl_table_alloc (struct mlx5_rl_table *table) +{ +int i; + + table->rl_entry =kcalloc (table->max_size,sizeof (struct mlx5_rl_entry ), +GFP_KERNEL ); +if (!table->rl_entry) +return -ENOMEM ; + +/* The index represents the index in HW rate limit table +* Index 0 is reserved for unlimited rate +*/ +for (i =0 ; i < table->max_size; i++) + table->rl_entry[i].index = i +1 ; + +return 0 ; +} + +static void mlx5_rl_table_free (struct mlx5_core_dev *dev,struct mlx5_rl_table *table) +{ +int i; + +/* Clear all configured rates */ +for (i =0 ; i < table->max_size; i++) +if (table->rl_entry[i].refcount) +mlx5_set_pp_rate_limit_cmd (dev, &table->rl_entry[i], false); +kfree (table->rl_entry); +} +int mlx5_rl_add_rate_raw (struct mlx5_core_dev *dev,void *rl_in,u16 uid,bool dedicated_entry,u16 *index) {
@@ -302,7 +331,7 @@ EXPORT_SYMBOL(mlx5_rl_remove_rate);int mlx5_init_rl_table (struct mlx5_core_dev *dev) {struct mlx5_rl_table *table = &dev->priv.rl_table; -int i; +int err;mutex_init (&table->rl_lock);if (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, packet_pacing)) {
@@ -315,18 +344,10 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev) table->max_rate =MLX5_CAP_QOS (dev, packet_pacing_max_rate); table->min_rate =MLX5_CAP_QOS (dev, packet_pacing_min_rate); - table->rl_entry =kcalloc (table->max_size,sizeof (struct mlx5_rl_entry ), -GFP_KERNEL ); -if (!table->rl_entry) -return -ENOMEM ; - -/* The index represents the index in HW rate limit table -* Index 0 is reserved for unlimited rate -*/ -for (i =0 ; i < table->max_size; i++) - table->rl_entry[i].index = i +1 ; + err =mlx5_rl_table_alloc (table); +if (err) +return err; -/* Index 0 is reserved */ mlx5_core_info(dev, "Rate limit: %u rates are supported, range: %uMbps to %uMbps\n", table->max_size, table->min_rate >> 10,
@@ -338,13 +359,9 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev)void mlx5_cleanup_rl_table (struct mlx5_core_dev *dev) {struct mlx5_rl_table *table = &dev->priv.rl_table; -int i; -/* Clear all configured rates */ -for (i =0 ; i < table->max_size; i++) -if (table->rl_entry[i].refcount) -mlx5_set_pp_rate_limit_cmd (dev, &table->rl_entry[i], - false); +if (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, packet_pacing)) +return ; -kfree (dev->priv.rl_table.rl_entry); +mlx5_rl_table_free (dev, table); }
Signature · 1 line
2.30.2
PATCH 8/16 net/mlx5: Use helper to increment, decrement rate entry refcount
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Rate limit entry refcount can be incremented uniformly when it is newly allocated or reused.
So simplify the code to increment refcount at one place.
Use decrement refcount helper in two routines.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 34 +++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +18 -16
@@ -201,6 +201,19 @@ static void mlx5_rl_table_free(struct mlx5_core_dev *dev, struct mlx5_rl_table *kfree (table->rl_entry); } +static void mlx5_rl_entry_get (struct mlx5_rl_entry *entry) +{ + entry->refcount++; +} + +static void +mlx5_rl_entry_put (struct mlx5_core_dev *dev,struct mlx5_rl_entry *entry) +{ + entry->refcount--; +if (!entry->refcount) +mlx5_set_pp_rate_limit_cmd (dev, entry, false); +} +int mlx5_rl_add_rate_raw (struct mlx5_core_dev *dev,void *rl_in,u16 uid,bool dedicated_entry,u16 *index) {
@@ -228,13 +241,10 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, err = -ENOSPC ; goto out; } -if (entry->refcount) { -/* rate already configured */ - entry->refcount++; - }else { +if (!entry->refcount) { +/* new rate limit */ memcpy (entry->rl_raw, rl_in,sizeof (entry->rl_raw)); entry->uid = uid; -/* new rate limit */ err =mlx5_set_pp_rate_limit_cmd (dev, entry, true);if (err) { mlx5_core_err(
@@ -248,9 +258,9 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, goto out; } - entry->refcount =1 ; entry->dedicated = dedicated_entry; } +mlx5_rl_entry_get (entry); *index = entry->index; out:
@@ -266,10 +276,7 @@ void mlx5_rl_remove_rate_raw(struct mlx5_core_dev *dev, u16 index)mutex_lock (&table->rl_lock); entry = &table->rl_entry[index -1 ]; - entry->refcount--; -if (!entry->refcount) -/* need to remove rate */ -mlx5_set_pp_rate_limit_cmd (dev, entry, false); +mlx5_rl_entry_put (dev, entry);mutex_unlock (&table->rl_lock); }EXPORT_SYMBOL (mlx5_rl_remove_rate_raw);
@@ -317,12 +324,7 @@ void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl) rl->rate, rl->max_burst_sz, rl->typical_pkt_sz); goto out; } - - entry->refcount--; -if (!entry->refcount) -/* need to remove rate */ -mlx5_set_pp_rate_limit_cmd (dev, entry, false); - +mlx5_rl_entry_put (dev, entry); out:mutex_unlock (&table->rl_lock); }
Signature · 1 line
2.30.2
PATCH 9/16 net/mlx5: Allocate rate limit table when rate is configured
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
A device supports 128 rate limiters. A static table allocation consumes 8KB of memory even when rate is not configured.
Instead, allocate the table when at least one rate is configured.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 46 ++++++++++++++++---- include/linux/mlx5/driver.h | 1 + 2 files changed, 38 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +37 -9
@@ -117,6 +117,9 @@ static struct mlx5_rl_entry *find_rl_entry(struct mlx5_rl_table *table,bool empty_found = false;int i; +lockdep_assert_held (&table->rl_lock); +WARN_ON (!table->rl_entry); +for (i =0 ; i < table->max_size; i++) {if (dedicated) {if (!table->rl_entry[i].refcount)
@@ -172,10 +175,17 @@ bool mlx5_rl_are_equal(struct mlx5_rate_limit *rl_0, }EXPORT_SYMBOL (mlx5_rl_are_equal); -static int mlx5_rl_table_alloc (struct mlx5_rl_table *table) +static int mlx5_rl_table_get (struct mlx5_rl_table *table) {int i; +lockdep_assert_held (&table->rl_lock); + +if (table->rl_entry) { + table->refcount++; +return 0 ; + } + table->rl_entry =kcalloc (table->max_size,sizeof (struct mlx5_rl_entry ),GFP_KERNEL );if (!table->rl_entry)
@@ -187,13 +197,27 @@ static int mlx5_rl_table_alloc(struct mlx5_rl_table *table)for (i =0 ; i < table->max_size; i++) table->rl_entry[i].index = i +1 ; + table->refcount++;return 0 ; } +static void mlx5_rl_table_put (struct mlx5_rl_table *table) +{ +lockdep_assert_held (&table->rl_lock); +if (--table->refcount) +return ; + +kfree (table->rl_entry); + table->rl_entry =NULL ; +} +static void mlx5_rl_table_free (struct mlx5_core_dev *dev,struct mlx5_rl_table *table) {int i; +if (!table->rl_entry) +return ; +/* Clear all configured rates */ for (i =0 ; i < table->max_size; i++)if (table->rl_entry[i].refcount)
@@ -219,8 +243,8 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, {struct mlx5_rl_table *table = &dev->priv.rl_table;struct mlx5_rl_entry *entry; -int err =0 ;u32 rate; +int err;if (!table->max_size)return -EOPNOTSUPP ;
@@ -233,13 +257,16 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, }mutex_lock (&table->rl_lock); + err =mlx5_rl_table_get (table); +if (err) + goto out; entry =find_rl_entry (table, rl_in, uid, dedicated_entry);if (!entry) {mlx5_core_err (dev,"Max number of %u rates reached\n" , table->max_size); err = -ENOSPC ; - goto out; + goto rl_err; }if (!entry->refcount) {/* new rate limit */
@@ -255,14 +282,18 @@ int mlx5_rl_add_rate_raw(struct mlx5_core_dev *dev, void *rl_in, u16 uid, burst_upper_bound),MLX5_GET (set_pp_rate_limit_context, rl_in, typical_packet_size)); - goto out; + goto rl_err; } entry->dedicated = dedicated_entry; }mlx5_rl_entry_get (entry); *index = entry->index; +mutex_unlock (&table->rl_lock); +return 0 ; +rl_err: +mlx5_rl_table_put (table); out:mutex_unlock (&table->rl_lock);return err;
@@ -277,6 +308,7 @@ void mlx5_rl_remove_rate_raw(struct mlx5_core_dev *dev, u16 index)mutex_lock (&table->rl_lock); entry = &table->rl_entry[index -1 ];mlx5_rl_entry_put (dev, entry); +mlx5_rl_table_put (table);mutex_unlock (&table->rl_lock); }EXPORT_SYMBOL (mlx5_rl_remove_rate_raw);
@@ -325,6 +357,7 @@ void mlx5_rl_remove_rate(struct mlx5_core_dev *dev, struct mlx5_rate_limit *rl) goto out; }mlx5_rl_entry_put (dev, entry); +mlx5_rl_table_put (table); out:mutex_unlock (&table->rl_lock); }
@@ -333,7 +366,6 @@ EXPORT_SYMBOL(mlx5_rl_remove_rate);int mlx5_init_rl_table (struct mlx5_core_dev *dev) {struct mlx5_rl_table *table = &dev->priv.rl_table; -int err;mutex_init (&table->rl_lock);if (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, packet_pacing)) {
@@ -346,10 +378,6 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev) table->max_rate =MLX5_CAP_QOS (dev, packet_pacing_max_rate); table->min_rate =MLX5_CAP_QOS (dev, packet_pacing_min_rate); - err =mlx5_rl_table_alloc (table); -if (err) -return err; - mlx5_core_info(dev, "Rate limit: %u rates are supported, range: %uMbps to %uMbps\n", table->max_size, table->min_rate >> 10,
include/linux/mlx5/driver.h +1 -0
@@ -530,6 +530,7 @@ struct mlx5_rl_table {u32 max_rate;u32 min_rate;struct mlx5_rl_entry *rl_entry; +u64 refcount; };struct mlx5_core_roce {
Signature · 1 line
2.30.2
PATCH 10/16 net/mlx5: Pair mutex_destory with mutex_init for rate limit table
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Add missing mutex_destroy() to pair with mutex_init().
This should be done only when table is initialized, hence perform mutex_init() only when table is initialized.
--- drivers/net/ethernet/mellanox/mlx5/core/rl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/rl.c +3 -1
@@ -367,12 +367,13 @@ int mlx5_init_rl_table(struct mlx5_core_dev *dev) {struct mlx5_rl_table *table = &dev->priv.rl_table; -mutex_init (&table->rl_lock);if (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, packet_pacing)) { table->max_size =0 ;return 0 ; } +mutex_init (&table->rl_lock); +/* First entry is reserved for unlimited rate */ table->max_size =MLX5_CAP_QOS (dev, packet_pacing_rate_table_size) -1 ; table->max_rate =MLX5_CAP_QOS (dev, packet_pacing_max_rate);
@@ -394,4 +395,5 @@ void mlx5_cleanup_rl_table(struct mlx5_core_dev *dev)return ;mlx5_rl_table_free (dev, table); +mutex_destroy (&table->rl_lock); }
Signature · 1 line
2.30.2
PATCH 11/16 net/mlx5: E-Switch, cut down mlx5_vport_info structure size by 8 bytes
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Structure mlx5_vport_info consumes 40 bytes of space due to a hole in it. After packing it reduces to 32 bytes.
Currently:
pahole -C mlx5_vport_info drivers/net/ethernet/mellanox/mlx5/core/eswitch.o struct mlx5_vport_info {
u8 mac[6]; /* 0 6 */
u16 vlan; /* 6 2 */
u8 qos; /* 8 1 *//* XXX 7 bytes hole, try to pack */
u64 node_guid; /* 16 8 */
int link_state; /* 24 4 */
u32 min_rate; /* 28 4 */
u32 max_rate; /* 32 4 */
bool spoofchk; /* 36 1 */
bool trusted; /* 37 1 */
/* size: 40, cachelines: 1, members: 9 */ /* sum members: 31, holes: 1, sum holes: 7 */ /* padding: 2 */
/* last cacheline: 40 bytes */
};
After packing:
$ pahole -C mlx5_vport_info drivers/net/ethernet/mellanox/mlx5/core/eswitch.o
struct mlx5_vport_info {
u8 mac[6]; /* 0 6 */
u16 vlan; /* 6 2 */
u64 node_guid; /* 8 8 */
int link_state; /* 16 4 */
u32 min_rate; /* 20 4 */
u32 max_rate; /* 24 4 */
u8 qos; /* 28 1 */
u8 spoofchk:1; /* 29: 0 1 */
u8 trusted:1; /* 29: 1 1 */ /* size: 32, cachelines: 1, members: 9 */
/* padding: 2 */
/* bit_padding: 6 bits */
/* last cacheline: 32 bytes */
};--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +2 -0
@@ -120,6 +120,8 @@ struct mlx5_vport_info {u16 vlan;u64 node_guid;int link_state; +u32 min_rate; +u32 max_rate;u8 qos; u8 spoofchk: 1; u8 trusted: 1;
Signature · 1 line
2.30.2
PATCH 12/16 net/mlx5: E-Switch, move QoS specific fields to existing qos struct
In reply to Saeed MahameedFrom: Parav Pandit <[email protected]>
Function QoS related fields are already defined in qos related struct. min and max rate are left out to mlx5_vport_info struct.
Move them to existing qos struct.
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +0 -2
@@ -120,8 +120,6 @@ struct mlx5_vport_info {u16 vlan;u64 node_guid;int link_state; -u32 min_rate; -u32 max_rate;u8 qos; u8 spoofchk: 1; u8 trusted: 1;
Signature · 1 line
2.30.2
PATCH 13/16 net/mlx5: Use ida_alloc_range() instead of ida_simple_alloc()
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
ida_simple_alloc() and remove functions are deprecated.
Related change:
commit 3264ceec8f17 ("lib/idr.c: document that ida_simple_{get,remove}() are deprecated")
--- drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/lib/gid.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c +3 -3
@@ -707,7 +707,7 @@ static void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev, }if (accel_xfrm->attrs.action ==MLX5_ACCEL_ESP_ACTION_DECRYPT ) { - err =ida_simple_get (&fipsec->halloc,1 ,0 ,GFP_KERNEL ); + err =ida_alloc_min (&fipsec->halloc,1 ,GFP_KERNEL );if (err <0 ) { context =ERR_PTR (err); goto exists;
@@ -758,7 +758,7 @@ static void *mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev, unlock_hash:mutex_unlock (&fipsec->sa_hash_lock);if (accel_xfrm->attrs.action ==MLX5_ACCEL_ESP_ACTION_DECRYPT ) -ida_simple_remove (&fipsec->halloc, sa_ctx->sa_handle); +ida_free (&fipsec->halloc, sa_ctx->sa_handle); exists:mutex_unlock (&fpga_xfrm->lock);kfree (sa_ctx);
@@ -852,7 +852,7 @@ mlx5_fpga_ipsec_release_sa_ctx(struct mlx5_fpga_ipsec_sa_ctx *sa_ctx)if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action &MLX5_ACCEL_ESP_ACTION_DECRYPT ) -ida_simple_remove (&fipsec->halloc, sa_ctx->sa_handle); +ida_free (&fipsec->halloc, sa_ctx->sa_handle);mutex_lock (&fipsec->sa_hash_lock); WARN_ON(rhashtable_remove_fast(&fipsec->sa_hash, &sa_ctx->hash,
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +3 -3
@@ -590,7 +590,7 @@ static void del_sw_fte(struct fs_node *node) &fte->hash, rhash_fte);WARN_ON (err); -ida_simple_remove (&fg->fte_allocator, fte->index - fg->start_index); +ida_free (&fg->fte_allocator, fte->index - fg->start_index);kmem_cache_free (steering->ftes_cache, fte); }
@@ -640,7 +640,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)int index;int ret; - index =ida_simple_get (&fg->fte_allocator,0 , fg->max_ftes,GFP_KERNEL ); + index =ida_alloc_max (&fg->fte_allocator, fg->max_ftes -1 ,GFP_KERNEL );if (index <0 )return index;
@@ -656,7 +656,7 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)return 0 ; err_ida_remove: -ida_simple_remove (&fg->fte_allocator, index); +ida_free (&fg->fte_allocator, index);return ret; }
drivers/net/ethernet/mellanox/mlx5/core/lib/gid.c +5 -5
@@ -88,12 +88,12 @@ void mlx5_core_unreserve_gids(struct mlx5_core_dev *dev, unsigned int count)int mlx5_core_reserved_gid_alloc (struct mlx5_core_dev *dev,int *gid_index) {int end = dev->roce.reserved_gids.start + - dev->roce.reserved_gids.count; + dev->roce.reserved_gids.count -1 ;int index =0 ; - index =ida_simple_get (&dev->roce.reserved_gids.ida, - dev->roce.reserved_gids.start, end, -GFP_KERNEL ); + index =ida_alloc_range (&dev->roce.reserved_gids.ida, + dev->roce.reserved_gids.start, end, +GFP_KERNEL );if (index <0 )return index;
@@ -105,7 +105,7 @@ int mlx5_core_reserved_gid_alloc(struct mlx5_core_dev *dev, int *gid_index)void mlx5_core_reserved_gid_free (struct mlx5_core_dev *dev,int gid_index) {mlx5_core_dbg (dev,"Freeing reserved GID %u\n" , gid_index); -ida_simple_remove (&dev->roce.reserved_gids.ida, gid_index); +ida_free (&dev->roce.reserved_gids.ida, gid_index); }unsigned int mlx5_core_reserved_gids_count (struct mlx5_core_dev *dev)
Signature · 1 line
2.30.2
PATCH 14/16 net/mlx5e: Reject tc rules which redirect from a VF to itself
In reply to Saeed MahameedFrom: Ariel Levkovich <[email protected]>
Since there are self loopback prevention mechanisms at the VF level, offloading such rules which redirect from a VF to itself in the eswitch will break the datapath since the packets will be dropped once they go back to the vport they came from.
Therefore, offloading such rules will be rejected and left to be handled by SW.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +13 -0
@@ -3111,6 +3111,13 @@ static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)return (fsystem_guid == psystem_guid); } +static bool same_vf_reps (struct mlx5e_priv *priv, +struct net_device *out_dev) +{ +return mlx5e_eswitch_vf_rep (priv->netdev) && + priv->netdev == out_dev; +} + static int add_vlan_rewrite_action(struct mlx5e_priv *priv, int namespace, const struct flow_action_entry *act, struct mlx5e_tc_flow_parse_attr *parse_attr,
@@ -3796,6 +3803,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,return -EOPNOTSUPP ; } +if (same_vf_reps (priv, out_dev)) { +NL_SET_ERR_MSG_MOD (extack, +"can't forward from a VF to itself" ); +return -EOPNOTSUPP ; + } + out_priv =netdev_priv (out_dev); rpriv = out_priv->ppriv; esw_attr->dests[esw_attr->out_count].rep = rpriv->rep;
Signature · 1 line
2.30.2
PATCH 15/16 net/mlx5e: Dynamic alloc arfs table for netdev when needed
In reply to Saeed MahameedFrom: Vu Pham <[email protected]>
Dynamic allocate arfs table in mlx5e_priv for EN netdev when needed. Don't allocate it for representor netdev.
--- .../net/ethernet/mellanox/mlx5/core/en/fs.h | 28 +----- .../net/ethernet/mellanox/mlx5/core/en_arfs.c | 95 +++++++++++++------ 2 files changed, 69 insertions(+), 54 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +2 -26
@@ -200,31 +200,7 @@ static inline int mlx5e_ethtool_get_rxnfc(struct net_device *dev,#endif /* CONFIG_MLX5_EN_RXNFC */ #ifdef CONFIG_MLX5_EN_ARFS -#define ARFS_HASH_SHIFT BITS_PER_BYTE -#define ARFS_HASH_SIZE BIT(BITS_PER_BYTE) - -struct arfs_table { -struct mlx5e_flow_table ft; -struct mlx5_flow_handle *default_rule; -struct hlist_head rules_hash[ARFS_HASH_SIZE ]; -}; - -enum arfs_type { -ARFS_IPV4_TCP , -ARFS_IPV6_TCP , -ARFS_IPV4_UDP , -ARFS_IPV6_UDP , -ARFS_NUM_TYPES , -}; - -struct mlx5e_arfs_tables { -struct arfs_table arfs_tables[ARFS_NUM_TYPES ]; -/* Protect aRFS rules list */ -spinlock_t arfs_lock; -struct list_head rules; -int last_filter_id; -struct workqueue_struct *wq; -}; +struct mlx5e_arfs_tables ;int mlx5e_arfs_create_tables (struct mlx5e_priv *priv);void mlx5e_arfs_destroy_tables (struct mlx5e_priv *priv);
@@ -260,7 +236,7 @@ struct mlx5e_flow_steering {struct mlx5e_ttc_table ttc;struct mlx5e_ttc_table inner_ttc;#ifdef CONFIG_MLX5_EN_ARFS -struct mlx5e_arfs_tables arfs; +struct mlx5e_arfs_tables *arfs;#endif #ifdef CONFIG_MLX5_EN_TLS struct mlx5e_accel_fs_tcp *accel_tcp;
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +67 -28
196 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 16/16 net/mlx5e: Dynamic alloc vlan table for netdev when needed
In reply to Saeed MahameedFrom: Vu Pham <[email protected]>
Dynamic allocate vlan table in mlx5e_priv for EN netdev when needed. Don't allocate it for representor netdev.
--- .../net/ethernet/mellanox/mlx5/core/en/fs.h | 18 +-- .../net/ethernet/mellanox/mlx5/core/en_fs.c | 132 +++++++++++------- .../net/ethernet/mellanox/mlx5/core/en_main.c | 3 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +- 4 files changed, 90 insertions(+), 67 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +5 -13
@@ -49,18 +49,10 @@ struct mlx5e_promisc_table {struct mlx5_flow_handle *rule; }; -struct mlx5e_vlan_table { -struct mlx5e_flow_table ft; - DECLARE_BITMAP(active_cvlans, VLAN_N_VID); - DECLARE_BITMAP(active_svlans, VLAN_N_VID); -struct mlx5_flow_handle *active_cvlans_rule[VLAN_N_VID ]; -struct mlx5_flow_handle *active_svlans_rule[VLAN_N_VID ]; -struct mlx5_flow_handle *untagged_rule; -struct mlx5_flow_handle *any_cvlan_rule; -struct mlx5_flow_handle *any_svlan_rule; -struct mlx5_flow_handle *trap_rule; -bool cvlan_filter_disabled; -}; +/* Forward declaration and APIs to get private fields of vlan_table */ +struct mlx5e_vlan_table ; +unsigned long *mlx5e_vlan_get_active_svlans (struct mlx5e_vlan_table *vlan); +struct mlx5_flow_table *mlx5e_vlan_get_flowtable (struct mlx5e_vlan_table *vlan);struct mlx5e_l2_table {struct mlx5e_flow_table ft;
@@ -231,7 +223,7 @@ struct mlx5e_flow_steering {#endif struct mlx5e_tc_table tc;struct mlx5e_promisc_table promisc; -struct mlx5e_vlan_table vlan; +struct mlx5e_vlan_table *vlan;struct mlx5e_l2_table l2;struct mlx5e_ttc_table ttc;struct mlx5e_ttc_table inner_ttc;
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +81 -51
319 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -1
@@ -3823,7 +3823,8 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,mutex_lock (&priv->state_lock); params = &priv->channels.params; -if (!bitmap_empty (priv->fs.vlan.active_svlans,VLAN_N_VID )) { +if (!priv->fs.vlan || + !bitmap_empty (mlx5e_vlan_get_active_svlans (priv->fs.vlan),VLAN_N_VID )) {/* HW strips the outer C-tag header, this is a problem * for S-tag traffic. */
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -2
@@ -906,7 +906,7 @@ mlx5e_add_offloaded_nic_rule(struct mlx5e_priv *priv,if (IS_ERR (dest[dest_ix].ft))return ERR_CAST (dest[dest_ix].ft); }else { - dest[dest_ix].ft = priv->fs.vlan.ft.t; + dest[dest_ix].ft =mlx5e_vlan_get_flowtable (priv->fs.vlan); } dest_ix++; }
@@ -4753,7 +4753,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv) attr.ns =MLX5_FLOW_NAMESPACE_KERNEL ; attr.max_ft_sz =mlx5e_tc_nic_get_ft_size (dev); attr.max_grp_num =MLX5E_TC_TABLE_NUM_GROUPS ; - attr.default_ft = priv->fs.vlan.ft.t; + attr.default_ft =mlx5e_vlan_get_flowtable (priv->fs.vlan); tc->chains =mlx5_chains_create (dev, &attr);if (IS_ERR (tc->chains)) {
Signature · 1 line
2.30.2