@@ -1352,6 +1352,17 @@ void mlx5e_close_rq(struct mlx5e_rq *rq)
13521352 mlx5e_free_rq (rq );
13531353}
13541354
1355+ u32 mlx5e_profile_get_tisn (struct mlx5_core_dev * mdev ,
1356+ struct mlx5e_priv * priv ,
1357+ const struct mlx5e_profile * profile ,
1358+ u8 lag_port , u8 tc )
1359+ {
1360+ if (profile -> get_tisn )
1361+ return profile -> get_tisn (mdev , priv , lag_port , tc );
1362+
1363+ return mdev -> mlx5e_res .hw_objs .tisn [lag_port ][tc ];
1364+ }
1365+
13551366static void mlx5e_free_xdpsq_db (struct mlx5e_xdpsq * sq )
13561367{
13571368 kvfree (sq -> db .xdpi_fifo .xi );
@@ -1920,7 +1931,8 @@ int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
19201931 return err ;
19211932
19221933 csp .tis_lst_sz = 1 ;
1923- csp .tisn = c -> priv -> tisn [c -> lag_port ][0 ]; /* tc = 0 */
1934+ csp .tisn = mlx5e_profile_get_tisn (c -> mdev , c -> priv , c -> priv -> profile ,
1935+ c -> lag_port , 0 ); /* tc = 0 */
19241936 csp .cqn = sq -> cq .mcq .cqn ;
19251937 csp .wq_ctrl = & sq -> wq_ctrl ;
19261938 csp .min_inline_mode = sq -> min_inline_mode ;
@@ -2204,12 +2216,15 @@ static int mlx5e_open_sqs(struct mlx5e_channel *c,
22042216 for (tc = 0 ; tc < mlx5e_get_dcb_num_tc (params ); tc ++ ) {
22052217 int txq_ix = c -> ix + tc * params -> num_channels ;
22062218 u32 qos_queue_group_id ;
2219+ u32 tisn ;
22072220
2221+ tisn = mlx5e_profile_get_tisn (c -> mdev , c -> priv , c -> priv -> profile ,
2222+ c -> lag_port , tc );
22082223 err = mlx5e_txq_get_qos_node_hw_id (params , txq_ix , & qos_queue_group_id );
22092224 if (err )
22102225 goto err_close_sqs ;
22112226
2212- err = mlx5e_open_txqsq (c , c -> priv -> tisn [ c -> lag_port ][ tc ] , txq_ix ,
2227+ err = mlx5e_open_txqsq (c , tisn , txq_ix ,
22132228 params , & cparam -> txq_sq , & c -> sq [tc ], tc ,
22142229 qos_queue_group_id ,
22152230 & c -> priv -> channel_stats [c -> ix ]-> sq [tc ]);
@@ -3351,72 +3366,6 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq)
33513366 mlx5e_free_cq (& drop_rq -> cq );
33523367}
33533368
3354- int mlx5e_create_tis (struct mlx5_core_dev * mdev , void * in , u32 * tisn )
3355- {
3356- void * tisc = MLX5_ADDR_OF (create_tis_in , in , ctx );
3357-
3358- MLX5_SET (tisc , tisc , transport_domain , mdev -> mlx5e_res .hw_objs .td .tdn );
3359-
3360- if (mlx5_lag_is_lacp_owner (mdev ))
3361- MLX5_SET (tisc , tisc , strict_lag_tx_port_affinity , 1 );
3362-
3363- return mlx5_core_create_tis (mdev , in , tisn );
3364- }
3365-
3366- void mlx5e_destroy_tis (struct mlx5_core_dev * mdev , u32 tisn )
3367- {
3368- mlx5_core_destroy_tis (mdev , tisn );
3369- }
3370-
3371- void mlx5e_destroy_tises (struct mlx5e_priv * priv )
3372- {
3373- int tc , i ;
3374-
3375- for (i = 0 ; i < mlx5e_get_num_lag_ports (priv -> mdev ); i ++ )
3376- for (tc = 0 ; tc < priv -> profile -> max_tc ; tc ++ )
3377- mlx5e_destroy_tis (priv -> mdev , priv -> tisn [i ][tc ]);
3378- }
3379-
3380- static bool mlx5e_lag_should_assign_affinity (struct mlx5_core_dev * mdev )
3381- {
3382- return MLX5_CAP_GEN (mdev , lag_tx_port_affinity ) && mlx5e_get_num_lag_ports (mdev ) > 1 ;
3383- }
3384-
3385- int mlx5e_create_tises (struct mlx5e_priv * priv )
3386- {
3387- int tc , i ;
3388- int err ;
3389-
3390- for (i = 0 ; i < mlx5e_get_num_lag_ports (priv -> mdev ); i ++ ) {
3391- for (tc = 0 ; tc < priv -> profile -> max_tc ; tc ++ ) {
3392- u32 in [MLX5_ST_SZ_DW (create_tis_in )] = {};
3393- void * tisc ;
3394-
3395- tisc = MLX5_ADDR_OF (create_tis_in , in , ctx );
3396-
3397- MLX5_SET (tisc , tisc , prio , tc << 1 );
3398-
3399- if (mlx5e_lag_should_assign_affinity (priv -> mdev ))
3400- MLX5_SET (tisc , tisc , lag_tx_port_affinity , i + 1 );
3401-
3402- err = mlx5e_create_tis (priv -> mdev , in , & priv -> tisn [i ][tc ]);
3403- if (err )
3404- goto err_close_tises ;
3405- }
3406- }
3407-
3408- return 0 ;
3409-
3410- err_close_tises :
3411- for (; i >= 0 ; i -- ) {
3412- for (tc -- ; tc >= 0 ; tc -- )
3413- mlx5e_destroy_tis (priv -> mdev , priv -> tisn [i ][tc ]);
3414- tc = priv -> profile -> max_tc ;
3415- }
3416-
3417- return err ;
3418- }
3419-
34203369static void mlx5e_cleanup_nic_tx (struct mlx5e_priv * priv )
34213370{
34223371 if (priv -> mqprio_rl ) {
@@ -3425,7 +3374,6 @@ static void mlx5e_cleanup_nic_tx(struct mlx5e_priv *priv)
34253374 priv -> mqprio_rl = NULL ;
34263375 }
34273376 mlx5e_accel_cleanup_tx (priv );
3428- mlx5e_destroy_tises (priv );
34293377}
34303378
34313379static int mlx5e_modify_channels_vsd (struct mlx5e_channels * chs , bool vsd )
@@ -3527,7 +3475,7 @@ static int mlx5e_setup_tc_mqprio_dcb(struct mlx5e_priv *priv,
35273475
35283476 mqprio -> hw = TC_MQPRIO_HW_OFFLOAD_TCS ;
35293477
3530- if (tc && tc != MLX5E_MAX_NUM_TC )
3478+ if (tc && tc != MLX5_MAX_NUM_TC )
35313479 return - EINVAL ;
35323480
35333481 new_params = priv -> channels .params ;
@@ -5482,23 +5430,13 @@ static int mlx5e_init_nic_tx(struct mlx5e_priv *priv)
54825430{
54835431 int err ;
54845432
5485- err = mlx5e_create_tises (priv );
5486- if (err ) {
5487- mlx5_core_warn (priv -> mdev , "create tises failed, %d\n" , err );
5488- return err ;
5489- }
5490-
54915433 err = mlx5e_accel_init_tx (priv );
54925434 if (err )
5493- goto err_destroy_tises ;
5435+ return err ;
54945436
54955437 mlx5e_set_mqprio_rl (priv );
54965438 mlx5e_dcbnl_initialize (priv );
54975439 return 0 ;
5498-
5499- err_destroy_tises :
5500- mlx5e_destroy_tises (priv );
5501- return err ;
55025440}
55035441
55045442static void mlx5e_nic_enable (struct mlx5e_priv * priv )
@@ -5593,7 +5531,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
55935531 .update_stats = mlx5e_stats_update_ndo_stats ,
55945532 .update_carrier = mlx5e_update_carrier ,
55955533 .rx_handlers = & mlx5e_rx_handlers_nic ,
5596- .max_tc = MLX5E_MAX_NUM_TC ,
5534+ .max_tc = MLX5_MAX_NUM_TC ,
55975535 .stats_grps = mlx5e_nic_stats_grps ,
55985536 .stats_grps_num = mlx5e_nic_stats_grps_num ,
55995537 .features = BIT (MLX5E_PROFILE_FEATURE_PTP_RX ) |
0 commit comments