aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Shamay <idos@mellanox.com>2015-04-02 09:31:15 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-02 16:25:03 -0400
commit08068cd5683f11e4505aa9c8cc6ed5942f8ad299 (patch)
tree0f33437e3ce4632eef998373876d932ec26e3410
parent666672d480fbae1af2e086f2bea200ed5607f967 (diff)
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 <idos@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c9
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw_qos.h3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c6
-rw-r--r--include/linux/mlx4/qp.h8
6 files changed, 30 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 7d3c64275b75..4c0c6c7e63e7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -48,6 +48,7 @@
48 48
49#include "mlx4.h" 49#include "mlx4.h"
50#include "fw.h" 50#include "fw.h"
51#include "fw_qos.h"
51 52
52#define CMD_POLL_TOKEN 0xffff 53#define CMD_POLL_TOKEN 0xffff
53#define INBOX_MASK 0xffffffffffffff00ULL 54#define INBOX_MASK 0xffffffffffffff00ULL
@@ -1808,7 +1809,8 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
1808 1809
1809 if (vp_oper->state.default_vlan == vp_admin->default_vlan && 1810 if (vp_oper->state.default_vlan == vp_admin->default_vlan &&
1810 vp_oper->state.default_qos == vp_admin->default_qos && 1811 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)
1812 return 0; 1814 return 0;
1813 1815
1814 if (!(priv->mfunc.master.slave_state[slave].active && 1816 if (!(priv->mfunc.master.slave_state[slave].active &&
@@ -1866,6 +1868,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
1866 vp_oper->state.default_vlan = vp_admin->default_vlan; 1868 vp_oper->state.default_vlan = vp_admin->default_vlan;
1867 vp_oper->state.default_qos = vp_admin->default_qos; 1869 vp_oper->state.default_qos = vp_admin->default_qos;
1868 vp_oper->state.link_state = vp_admin->link_state; 1870 vp_oper->state.link_state = vp_admin->link_state;
1871 vp_oper->state.qos_vport = vp_admin->qos_vport;
1869 1872
1870 if (vp_admin->link_state == IFLA_VF_LINK_STATE_DISABLE) 1873 if (vp_admin->link_state == IFLA_VF_LINK_STATE_DISABLE)
1871 work->flags |= MLX4_VF_IMMED_VLAN_FLAG_LINK_DISABLE; 1874 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,
1874 work->port = port; 1877 work->port = port;
1875 work->slave = slave; 1878 work->slave = slave;
1876 work->qos = vp_oper->state.default_qos; 1879 work->qos = vp_oper->state.default_qos;
1880 work->qos_vport = vp_oper->state.qos_vport;
1877 work->vlan_id = vp_oper->state.default_vlan; 1881 work->vlan_id = vp_oper->state.default_vlan;
1878 work->vlan_ix = vp_oper->vlan_idx; 1882 work->vlan_ix = vp_oper->vlan_idx;
1879 work->priv = priv; 1883 work->priv = priv;
@@ -2339,6 +2343,9 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
2339 INIT_LIST_HEAD(&s_state->mcast_filters[port]); 2343 INIT_LIST_HEAD(&s_state->mcast_filters[port]);
2340 admin_vport->default_vlan = MLX4_VGT; 2344 admin_vport->default_vlan = MLX4_VGT;
2341 oper_vport->default_vlan = MLX4_VGT; 2345 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;
2342 vf_oper->vport[port].vlan_idx = NO_INDX; 2349 vf_oper->vport[port].vlan_idx = NO_INDX;
2343 vf_oper->vport[port].mac_idx = NO_INDX; 2350 vf_oper->vport[port].mac_idx = NO_INDX;
2344 } 2351 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw_qos.h b/drivers/net/ethernet/mellanox/mlx4/fw_qos.h
index 4a5320f79094..ac1f331878e6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw_qos.h
+++ b/drivers/net/ethernet/mellanox/mlx4/fw_qos.h
@@ -44,6 +44,9 @@
44/* Default supported priorities for VPP allocation */ 44/* Default supported priorities for VPP allocation */
45#define MLX4_DEFAULT_QOS_PRIO (0) 45#define MLX4_DEFAULT_QOS_PRIO (0)
46 46
47/* Derived from FW feature definition, 0 is the default vport fo all QPs */
48#define MLX4_VPP_DEFAULT_VPORT (0)
49
47struct mlx4_vport_qos_param { 50struct mlx4_vport_qos_param {
48 u32 bw_share; 51 u32 bw_share;
49 u32 max_avg_bw; 52 u32 max_avg_bw;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index 1add698dba5b..32469c64d580 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -498,6 +498,7 @@ struct mlx4_vport_state {
498 u32 tx_rate; 498 u32 tx_rate;
499 bool spoofchk; 499 bool spoofchk;
500 u32 link_state; 500 u32 link_state;
501 u8 qos_vport;
501}; 502};
502 503
503struct mlx4_vf_admin_state { 504struct mlx4_vf_admin_state {
@@ -636,6 +637,7 @@ struct mlx4_vf_immed_vlan_work {
636 int orig_vlan_ix; 637 int orig_vlan_ix;
637 u8 port; 638 u8 port;
638 u8 qos; 639 u8 qos;
640 u8 qos_vport;
639 u16 vlan_id; 641 u16 vlan_id;
640 u16 orig_vlan_id; 642 u16 orig_vlan_id;
641}; 643};
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 69e4462e4ee4..b75214a80d0e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -447,6 +447,11 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
447 cmd->qp_context.rate_limit_params = cpu_to_be16((params->rate_unit << 14) | params->rate_val); 447 cmd->qp_context.rate_limit_params = cpu_to_be16((params->rate_unit << 14) | params->rate_val);
448 } 448 }
449 449
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
450 cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); 455 cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask);
451 cmd->qp_mask = cpu_to_be64(qp_mask); 456 cmd->qp_mask = cpu_to_be64(qp_mask);
452 457
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index fd2520aa8a8c..c7f28bf4b8e2 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -765,6 +765,7 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
765 qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN; 765 qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN;
766 qpc->pri_path.sched_queue &= 0xC7; 766 qpc->pri_path.sched_queue &= 0xC7;
767 qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3; 767 qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3;
768 qpc->qos_vport = vp_oper->state.qos_vport;
768 } 769 }
769 if (vp_oper->state.spoofchk) { 770 if (vp_oper->state.spoofchk) {
770 qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; 771 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)
4917 qp->sched_queue & 0xC7; 4918 qp->sched_queue & 0xC7;
4918 upd_context->qp_context.pri_path.sched_queue |= 4919 upd_context->qp_context.pri_path.sched_queue |=
4919 ((work->qos & 0x7) << 3); 4920 ((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;
4920 } 4926 }
4921 4927
4922 err = mlx4_cmd(dev, mailbox->dma, 4928 err = mlx4_cmd(dev, mailbox->dma,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 1023ebe035b7..6fed539e5456 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -209,7 +209,8 @@ struct mlx4_qp_context {
209 __be16 sq_wqe_counter; 209 __be16 sq_wqe_counter;
210 u32 reserved3; 210 u32 reserved3;
211 __be16 rate_limit_params; 211 __be16 rate_limit_params;
212 __be16 reserved4; 212 u8 reserved4;
213 u8 qos_vport;
213 __be32 param3; 214 __be32 param3;
214 __be32 nummmcpeers_basemkey; 215 __be32 nummmcpeers_basemkey;
215 u8 log_page_size; 216 u8 log_page_size;
@@ -231,6 +232,7 @@ struct mlx4_update_qp_context {
231enum { 232enum {
232 MLX4_UPD_QP_MASK_PM_STATE = 32, 233 MLX4_UPD_QP_MASK_PM_STATE = 32,
233 MLX4_UPD_QP_MASK_VSD = 33, 234 MLX4_UPD_QP_MASK_VSD = 33,
235 MLX4_UPD_QP_MASK_QOS_VPP = 34,
234 MLX4_UPD_QP_MASK_RATE_LIMIT = 35, 236 MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
235}; 237};
236 238
@@ -432,7 +434,8 @@ enum mlx4_update_qp_attr {
432 MLX4_UPDATE_QP_SMAC = 1 << 0, 434 MLX4_UPDATE_QP_SMAC = 1 << 0,
433 MLX4_UPDATE_QP_VSD = 1 << 1, 435 MLX4_UPDATE_QP_VSD = 1 << 1,
434 MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2, 436 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
436}; 439};
437 440
438enum mlx4_update_qp_params_flags { 441enum mlx4_update_qp_params_flags {
@@ -441,6 +444,7 @@ enum mlx4_update_qp_params_flags {
441 444
442struct mlx4_update_qp_params { 445struct mlx4_update_qp_params {
443 u8 smac_index; 446 u8 smac_index;
447 u8 qos_vport;
444 u32 flags; 448 u32 flags;
445 u16 rate_unit; 449 u16 rate_unit;
446 u16 rate_val; 450 u16 rate_val;