Skip to content

Commit 08068cd

Browse files
shamoyadavem330
authored andcommitted
net/mlx4: Added qos_vport QP configuration in VST mode
Granular QoS per VF feature introduce a new QP field, qos_vport. PF administrator can connect VF QPs to a certain QoS Vport, to inherit its proporties. Connecting QPs to the default QoS Vport (defined as 0) is always allowed, even when there are no allocated VPPs. At this point, only the default vport is connected to QPs. Signed-off-by: Ido Shamay <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 666672d commit 08068cd

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

drivers/net/ethernet/mellanox/mlx4/cmd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
#include "mlx4.h"
5050
#include "fw.h"
51+
#include "fw_qos.h"
5152

5253
#define CMD_POLL_TOKEN 0xffff
5354
#define INBOX_MASK 0xffffffffffffff00ULL
@@ -1808,7 +1809,8 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
18081809

18091810
if (vp_oper->state.default_vlan == vp_admin->default_vlan &&
18101811
vp_oper->state.default_qos == vp_admin->default_qos &&
1811-
vp_oper->state.link_state == vp_admin->link_state)
1812+
vp_oper->state.link_state == vp_admin->link_state &&
1813+
vp_oper->state.qos_vport == vp_admin->qos_vport)
18121814
return 0;
18131815

18141816
if (!(priv->mfunc.master.slave_state[slave].active &&
@@ -1866,6 +1868,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
18661868
vp_oper->state.default_vlan = vp_admin->default_vlan;
18671869
vp_oper->state.default_qos = vp_admin->default_qos;
18681870
vp_oper->state.link_state = vp_admin->link_state;
1871+
vp_oper->state.qos_vport = vp_admin->qos_vport;
18691872

18701873
if (vp_admin->link_state == IFLA_VF_LINK_STATE_DISABLE)
18711874
work->flags |= MLX4_VF_IMMED_VLAN_FLAG_LINK_DISABLE;
@@ -1874,6 +1877,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
18741877
work->port = port;
18751878
work->slave = slave;
18761879
work->qos = vp_oper->state.default_qos;
1880+
work->qos_vport = vp_oper->state.qos_vport;
18771881
work->vlan_id = vp_oper->state.default_vlan;
18781882
work->vlan_ix = vp_oper->vlan_idx;
18791883
work->priv = priv;
@@ -2339,6 +2343,9 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
23392343
INIT_LIST_HEAD(&s_state->mcast_filters[port]);
23402344
admin_vport->default_vlan = MLX4_VGT;
23412345
oper_vport->default_vlan = MLX4_VGT;
2346+
admin_vport->qos_vport =
2347+
MLX4_VPP_DEFAULT_VPORT;
2348+
oper_vport->qos_vport = MLX4_VPP_DEFAULT_VPORT;
23422349
vf_oper->vport[port].vlan_idx = NO_INDX;
23432350
vf_oper->vport[port].mac_idx = NO_INDX;
23442351
}

drivers/net/ethernet/mellanox/mlx4/fw_qos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
/* Default supported priorities for VPP allocation */
4545
#define MLX4_DEFAULT_QOS_PRIO (0)
4646

47+
/* Derived from FW feature definition, 0 is the default vport fo all QPs */
48+
#define MLX4_VPP_DEFAULT_VPORT (0)
49+
4750
struct mlx4_vport_qos_param {
4851
u32 bw_share;
4952
u32 max_avg_bw;

drivers/net/ethernet/mellanox/mlx4/mlx4.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ struct mlx4_vport_state {
498498
u32 tx_rate;
499499
bool spoofchk;
500500
u32 link_state;
501+
u8 qos_vport;
501502
};
502503

503504
struct mlx4_vf_admin_state {
@@ -636,6 +637,7 @@ struct mlx4_vf_immed_vlan_work {
636637
int orig_vlan_ix;
637638
u8 port;
638639
u8 qos;
640+
u8 qos_vport;
639641
u16 vlan_id;
640642
u16 orig_vlan_id;
641643
};

drivers/net/ethernet/mellanox/mlx4/qp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
447447
cmd->qp_context.rate_limit_params = cpu_to_be16((params->rate_unit << 14) | params->rate_val);
448448
}
449449

450+
if (attr & MLX4_UPDATE_QP_QOS_VPORT) {
451+
qp_mask |= 1ULL << MLX4_UPD_QP_MASK_QOS_VPP;
452+
cmd->qp_context.qos_vport = params->qos_vport;
453+
}
454+
450455
cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask);
451456
cmd->qp_mask = cpu_to_be64(qp_mask);
452457

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
765765
qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN;
766766
qpc->pri_path.sched_queue &= 0xC7;
767767
qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3;
768+
qpc->qos_vport = vp_oper->state.qos_vport;
768769
}
769770
if (vp_oper->state.spoofchk) {
770771
qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC;
@@ -4917,6 +4918,11 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
49174918
qp->sched_queue & 0xC7;
49184919
upd_context->qp_context.pri_path.sched_queue |=
49194920
((work->qos & 0x7) << 3);
4921+
upd_context->qp_mask |=
4922+
cpu_to_be64(1ULL <<
4923+
MLX4_UPD_QP_MASK_QOS_VPP);
4924+
upd_context->qp_context.qos_vport =
4925+
work->qos_vport;
49204926
}
49214927

49224928
err = mlx4_cmd(dev, mailbox->dma,

include/linux/mlx4/qp.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ struct mlx4_qp_context {
209209
__be16 sq_wqe_counter;
210210
u32 reserved3;
211211
__be16 rate_limit_params;
212-
__be16 reserved4;
212+
u8 reserved4;
213+
u8 qos_vport;
213214
__be32 param3;
214215
__be32 nummmcpeers_basemkey;
215216
u8 log_page_size;
@@ -231,6 +232,7 @@ struct mlx4_update_qp_context {
231232
enum {
232233
MLX4_UPD_QP_MASK_PM_STATE = 32,
233234
MLX4_UPD_QP_MASK_VSD = 33,
235+
MLX4_UPD_QP_MASK_QOS_VPP = 34,
234236
MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
235237
};
236238

@@ -432,7 +434,8 @@ enum mlx4_update_qp_attr {
432434
MLX4_UPDATE_QP_SMAC = 1 << 0,
433435
MLX4_UPDATE_QP_VSD = 1 << 1,
434436
MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
435-
MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 3) - 1
437+
MLX4_UPDATE_QP_QOS_VPORT = 1 << 3,
438+
MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 4) - 1
436439
};
437440

438441
enum mlx4_update_qp_params_flags {
@@ -441,6 +444,7 @@ enum mlx4_update_qp_params_flags {
441444

442445
struct mlx4_update_qp_params {
443446
u8 smac_index;
447+
u8 qos_vport;
444448
u32 flags;
445449
u16 rate_unit;
446450
u16 rate_val;

0 commit comments

Comments
 (0)