Merge branch 'mlx4-vf-vlan-802.1ad'
Tariq Toukan says:
====================
mlx4 VF vlan protocol 802.1ad support
This patchset adds VF VLAN protocol 802.1ad support to the
mlx4 driver.
We extended the VF VLAN API with an additional parameter
for VLAN protocol, and kept 802.1Q as drivers' default.
We prepared a userspace support (ip link tool).
The patch will be submitted to the iproute2 mailing list.
The ip link tool VF VLAN protocol parameter is optional (default: 802.1Q).
A configuration command of VF VLAN that is used prior to this patchset
will result in same functionality as today's (VST with VLAN protocol 802.1Q).
The series generated against net-next commit:
688dc5369a
"Merge branch 'mlx4-next'"
All maintainers of the modified modules are in cc.
v3:
Expand the UAPI to a nested list to support future use-cases.
Use a more formal feature name.
v2:
Drop patch 4 ("net/mlx4_core: Add an option to configure SVLAN TPID").
Patch 1/5: Update commit log.
2-3/5: Split patch 2 into two patches, to separate between changes
done in mlx4_core and the ones done in mlx4_en.
4-5/5: Split patch 3 into two patches, to separate between the
addition of a protocol parameter and the actual implementation
in mlx4_en.
In addition, we implement a handshake mechanism so PF and VF
exchange their VST QinQ support capability.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
1ad0751d42
|
@ -492,7 +492,8 @@ int __bnx2x_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
|
|||
int bnx2x_get_vf_config(struct net_device *dev, int vf,
|
||||
struct ifla_vf_info *ivi);
|
||||
int bnx2x_set_vf_mac(struct net_device *dev, int queue, u8 *mac);
|
||||
int bnx2x_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos);
|
||||
int bnx2x_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto);
|
||||
|
||||
/* select_queue callback */
|
||||
u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||
|
|
|
@ -2521,7 +2521,8 @@ void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp)
|
|||
for_each_vf(bp, vfidx) {
|
||||
bulletin = BP_VF_BULLETIN(bp, vfidx);
|
||||
if (bulletin->valid_bitmap & (1 << VLAN_VALID))
|
||||
bnx2x_set_vf_vlan(bp->dev, vfidx, bulletin->vlan, 0);
|
||||
bnx2x_set_vf_vlan(bp->dev, vfidx, bulletin->vlan, 0,
|
||||
htons(ETH_P_8021Q));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2781,7 +2782,8 @@ static int bnx2x_set_vf_vlan_filter(struct bnx2x *bp, struct bnx2x_virtf *vf,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos)
|
||||
int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct pf_vf_bulletin_content *bulletin = NULL;
|
||||
struct bnx2x *bp = netdev_priv(dev);
|
||||
|
@ -2796,6 +2798,9 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
DP(BNX2X_MSG_IOV, "configuring VF %d with VLAN %d qos %d\n",
|
||||
vfidx, vlan, 0);
|
||||
|
||||
|
|
|
@ -174,7 +174,8 @@ int bnxt_set_vf_mac(struct net_device *dev, int vf_id, u8 *mac)
|
|||
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||
}
|
||||
|
||||
int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos)
|
||||
int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct hwrm_func_cfg_input req = {0};
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
|
@ -185,6 +186,9 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos)
|
|||
if (bp->hwrm_spec_code < 0x10201)
|
||||
return -ENOTSUPP;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rc = bnxt_vf_ndo_prep(bp, vf_id);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
int bnxt_get_vf_config(struct net_device *, int, struct ifla_vf_info *);
|
||||
int bnxt_set_vf_mac(struct net_device *, int, u8 *);
|
||||
int bnxt_set_vf_vlan(struct net_device *, int, u16, u8);
|
||||
int bnxt_set_vf_vlan(struct net_device *, int, u16, u8, __be16);
|
||||
int bnxt_set_vf_bw(struct net_device *, int, int, int);
|
||||
int bnxt_set_vf_link_state(struct net_device *, int, int);
|
||||
int bnxt_set_vf_spoofchk(struct net_device *, int, bool);
|
||||
|
|
|
@ -1895,7 +1895,8 @@ static int be_clear_vf_tvt(struct be_adapter *adapter, int vf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
|
||||
static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct be_adapter *adapter = netdev_priv(netdev);
|
||||
struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
|
||||
|
@ -1907,6 +1908,9 @@ static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
|
|||
if (vf >= adapter->num_vfs || vlan > 4095 || qos > 7)
|
||||
return -EINVAL;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
if (vlan || qos) {
|
||||
vlan |= qos << VLAN_PRIO_SHIFT;
|
||||
status = be_set_vf_tvt(adapter, vf, vlan);
|
||||
|
|
|
@ -507,7 +507,7 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs);
|
|||
s32 fm10k_iov_update_pvid(struct fm10k_intfc *interface, u16 glort, u16 pvid);
|
||||
int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac);
|
||||
int fm10k_ndo_set_vf_vlan(struct net_device *netdev,
|
||||
int vf_idx, u16 vid, u8 qos);
|
||||
int vf_idx, u16 vid, u8 qos, __be16 vlan_proto);
|
||||
int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx, int rate,
|
||||
int unused);
|
||||
int fm10k_ndo_get_vf_config(struct net_device *netdev,
|
||||
|
|
|
@ -445,7 +445,7 @@ int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac)
|
|||
}
|
||||
|
||||
int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
|
||||
u8 qos)
|
||||
u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(netdev);
|
||||
struct fm10k_iov_data *iov_data = interface->iov_data;
|
||||
|
@ -460,6 +460,10 @@ int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
|
|||
if (qos || (vid > (VLAN_VID_MASK - 1)))
|
||||
return -EINVAL;
|
||||
|
||||
/* VF VLAN Protocol part to default is unsupported */
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
vf_info = &iov_data->vf_info[vf_idx];
|
||||
|
||||
/* exit if there is nothing to do */
|
||||
|
|
|
@ -2747,11 +2747,12 @@ error_param:
|
|||
* @vf_id: VF identifier
|
||||
* @vlan_id: mac address
|
||||
* @qos: priority setting
|
||||
* @vlan_proto: vlan protocol
|
||||
*
|
||||
* program VF vlan id and/or qos
|
||||
**/
|
||||
int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
|
||||
int vf_id, u16 vlan_id, u8 qos)
|
||||
int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
|
||||
u16 vlan_id, u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
u16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);
|
||||
struct i40e_netdev_priv *np = netdev_priv(netdev);
|
||||
|
@ -2774,6 +2775,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
|
|||
goto error_pvid;
|
||||
}
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q)) {
|
||||
dev_err(&pf->pdev->dev, "VF VLAN protocol is not supported\n");
|
||||
ret = -EPROTONOSUPPORT;
|
||||
goto error_pvid;
|
||||
}
|
||||
|
||||
vf = &(pf->vf[vf_id]);
|
||||
vsi = pf->vsi[vf->lan_vsi_idx];
|
||||
if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) {
|
||||
|
|
|
@ -129,8 +129,8 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf);
|
|||
|
||||
/* VF configuration related iplink handlers */
|
||||
int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac);
|
||||
int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
|
||||
int vf_id, u16 vlan_id, u8 qos);
|
||||
int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id,
|
||||
u16 vlan_id, u8 qos, __be16 vlan_proto);
|
||||
int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,
|
||||
int max_tx_rate);
|
||||
int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting);
|
||||
|
|
|
@ -169,7 +169,7 @@ static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *);
|
|||
static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
|
||||
static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
|
||||
static int igb_ndo_set_vf_vlan(struct net_device *netdev,
|
||||
int vf, u16 vlan, u8 qos);
|
||||
int vf, u16 vlan, u8 qos, __be16 vlan_proto);
|
||||
static int igb_ndo_set_vf_bw(struct net_device *, int, int, int);
|
||||
static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
|
||||
bool setting);
|
||||
|
@ -6222,14 +6222,17 @@ static int igb_disable_port_vlan(struct igb_adapter *adapter, int vf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int igb_ndo_set_vf_vlan(struct net_device *netdev,
|
||||
int vf, u16 vlan, u8 qos)
|
||||
static int igb_ndo_set_vf_vlan(struct net_device *netdev, int vf,
|
||||
u16 vlan, u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
struct igb_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7))
|
||||
return -EINVAL;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
return (vlan || qos) ? igb_enable_port_vlan(adapter, vf, vlan, qos) :
|
||||
igb_disable_port_vlan(adapter, vf);
|
||||
}
|
||||
|
|
|
@ -1354,13 +1354,16 @@ static int ixgbe_disable_port_vlan(struct ixgbe_adapter *adapter, int vf)
|
|||
return err;
|
||||
}
|
||||
|
||||
int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
|
||||
int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
|
||||
u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
int err = 0;
|
||||
struct ixgbe_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
|
||||
return -EINVAL;
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
if (vlan || qos) {
|
||||
/* Check if there is already a port VLAN set, if so
|
||||
* we have to delete the old one first before we
|
||||
|
|
|
@ -43,7 +43,7 @@ void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter);
|
|||
void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter);
|
||||
int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int queue, u8 *mac);
|
||||
int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
|
||||
u8 qos);
|
||||
u8 qos, __be16 vlan_proto);
|
||||
int ixgbe_link_mbps(struct ixgbe_adapter *adapter);
|
||||
int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
|
||||
int max_tx_rate);
|
||||
|
|
|
@ -1851,6 +1851,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
|
|||
|
||||
if (vp_oper->state.default_vlan == vp_admin->default_vlan &&
|
||||
vp_oper->state.default_qos == vp_admin->default_qos &&
|
||||
vp_oper->state.vlan_proto == vp_admin->vlan_proto &&
|
||||
vp_oper->state.link_state == vp_admin->link_state &&
|
||||
vp_oper->state.qos_vport == vp_admin->qos_vport)
|
||||
return 0;
|
||||
|
@ -1909,6 +1910,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
|
|||
|
||||
vp_oper->state.default_vlan = vp_admin->default_vlan;
|
||||
vp_oper->state.default_qos = vp_admin->default_qos;
|
||||
vp_oper->state.vlan_proto = vp_admin->vlan_proto;
|
||||
vp_oper->state.link_state = vp_admin->link_state;
|
||||
vp_oper->state.qos_vport = vp_admin->qos_vport;
|
||||
|
||||
|
@ -1922,6 +1924,7 @@ static int mlx4_master_immediate_activate_vlan_qos(struct mlx4_priv *priv,
|
|||
work->qos_vport = vp_oper->state.qos_vport;
|
||||
work->vlan_id = vp_oper->state.default_vlan;
|
||||
work->vlan_ix = vp_oper->vlan_idx;
|
||||
work->vlan_proto = vp_oper->state.vlan_proto;
|
||||
work->priv = priv;
|
||||
INIT_WORK(&work->work, mlx4_vf_immed_vlan_work_handler);
|
||||
queue_work(priv->mfunc.master.comm_wq, &work->work);
|
||||
|
@ -1992,6 +1995,8 @@ static int mlx4_master_activate_admin_state(struct mlx4_priv *priv, int slave)
|
|||
int port, err;
|
||||
struct mlx4_vport_state *vp_admin;
|
||||
struct mlx4_vport_oper_state *vp_oper;
|
||||
struct mlx4_slave_state *slave_state =
|
||||
&priv->mfunc.master.slave_state[slave];
|
||||
struct mlx4_active_ports actv_ports = mlx4_get_active_ports(
|
||||
&priv->dev, slave);
|
||||
int min_port = find_first_bit(actv_ports.ports,
|
||||
|
@ -2006,12 +2011,26 @@ static int mlx4_master_activate_admin_state(struct mlx4_priv *priv, int slave)
|
|||
priv->mfunc.master.vf_admin[slave].enable_smi[port];
|
||||
vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
|
||||
vp_admin = &priv->mfunc.master.vf_admin[slave].vport[port];
|
||||
vp_oper->state = *vp_admin;
|
||||
if (vp_admin->vlan_proto != htons(ETH_P_8021AD) ||
|
||||
slave_state->vst_qinq_supported) {
|
||||
vp_oper->state.vlan_proto = vp_admin->vlan_proto;
|
||||
vp_oper->state.default_vlan = vp_admin->default_vlan;
|
||||
vp_oper->state.default_qos = vp_admin->default_qos;
|
||||
}
|
||||
vp_oper->state.link_state = vp_admin->link_state;
|
||||
vp_oper->state.mac = vp_admin->mac;
|
||||
vp_oper->state.spoofchk = vp_admin->spoofchk;
|
||||
vp_oper->state.tx_rate = vp_admin->tx_rate;
|
||||
vp_oper->state.qos_vport = vp_admin->qos_vport;
|
||||
vp_oper->state.guid = vp_admin->guid;
|
||||
|
||||
if (MLX4_VGT != vp_admin->default_vlan) {
|
||||
err = __mlx4_register_vlan(&priv->dev, port,
|
||||
vp_admin->default_vlan, &(vp_oper->vlan_idx));
|
||||
if (err) {
|
||||
vp_oper->vlan_idx = NO_INDX;
|
||||
vp_oper->state.default_vlan = MLX4_VGT;
|
||||
vp_oper->state.vlan_proto = htons(ETH_P_8021Q);
|
||||
mlx4_warn(&priv->dev,
|
||||
"No vlan resources slave %d, port %d\n",
|
||||
slave, port);
|
||||
|
@ -2092,6 +2111,7 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd,
|
|||
mlx4_warn(dev, "Received reset from slave:%d\n", slave);
|
||||
slave_state[slave].active = false;
|
||||
slave_state[slave].old_vlan_api = false;
|
||||
slave_state[slave].vst_qinq_supported = false;
|
||||
mlx4_master_deactivate_admin_state(priv, slave);
|
||||
for (i = 0; i < MLX4_EVENT_TYPES_NUM; ++i) {
|
||||
slave_state[slave].event_eq[i].eqn = -1;
|
||||
|
@ -2359,6 +2379,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
|
|||
vf_oper = &priv->mfunc.master.vf_oper[i];
|
||||
s_state = &priv->mfunc.master.slave_state[i];
|
||||
s_state->last_cmd = MLX4_COMM_CMD_RESET;
|
||||
s_state->vst_qinq_supported = false;
|
||||
mutex_init(&priv->mfunc.master.gen_eqe_mutex[i]);
|
||||
for (j = 0; j < MLX4_EVENT_TYPES_NUM; ++j)
|
||||
s_state->event_eq[j].eqn = -1;
|
||||
|
@ -2388,6 +2409,8 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
|
|||
admin_vport->qos_vport =
|
||||
MLX4_VPP_DEFAULT_VPORT;
|
||||
oper_vport->qos_vport = MLX4_VPP_DEFAULT_VPORT;
|
||||
admin_vport->vlan_proto = htons(ETH_P_8021Q);
|
||||
oper_vport->vlan_proto = htons(ETH_P_8021Q);
|
||||
vf_oper->vport[port].vlan_idx = NO_INDX;
|
||||
vf_oper->vport[port].mac_idx = NO_INDX;
|
||||
mlx4_set_random_admin_guid(dev, i, port);
|
||||
|
@ -2948,10 +2971,13 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
|
|||
EXPORT_SYMBOL_GPL(mlx4_set_vf_mac);
|
||||
|
||||
|
||||
int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos)
|
||||
int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos,
|
||||
__be16 proto)
|
||||
{
|
||||
struct mlx4_priv *priv = mlx4_priv(dev);
|
||||
struct mlx4_vport_state *vf_admin;
|
||||
struct mlx4_slave_state *slave_state;
|
||||
struct mlx4_vport_oper_state *vf_oper;
|
||||
int slave;
|
||||
|
||||
if ((!mlx4_is_master(dev)) ||
|
||||
|
@ -2961,12 +2987,31 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos)
|
|||
if ((vlan > 4095) || (qos > 7))
|
||||
return -EINVAL;
|
||||
|
||||
if (proto == htons(ETH_P_8021AD) &&
|
||||
!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
if (proto != htons(ETH_P_8021Q) &&
|
||||
proto != htons(ETH_P_8021AD))
|
||||
return -EINVAL;
|
||||
|
||||
if ((proto == htons(ETH_P_8021AD)) &&
|
||||
((vlan == 0) || (vlan == MLX4_VGT)))
|
||||
return -EINVAL;
|
||||
|
||||
slave = mlx4_get_slave_indx(dev, vf);
|
||||
if (slave < 0)
|
||||
return -EINVAL;
|
||||
|
||||
slave_state = &priv->mfunc.master.slave_state[slave];
|
||||
if ((proto == htons(ETH_P_8021AD)) && (slave_state->active) &&
|
||||
(!slave_state->vst_qinq_supported)) {
|
||||
mlx4_err(dev, "vf %d does not support VST QinQ mode\n", vf);
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
port = mlx4_slaves_closest_port(dev, slave, port);
|
||||
vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port];
|
||||
vf_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
|
||||
|
||||
if (!mlx4_valid_vf_state_change(dev, port, vf_admin, vlan, qos))
|
||||
return -EPERM;
|
||||
|
@ -2976,6 +3021,7 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos)
|
|||
else
|
||||
vf_admin->default_vlan = vlan;
|
||||
vf_admin->default_qos = qos;
|
||||
vf_admin->vlan_proto = proto;
|
||||
|
||||
/* If rate was configured prior to VST, we saved the configured rate
|
||||
* in vf_admin->rate and now, if priority supported we enforce the QoS
|
||||
|
@ -2984,7 +3030,12 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos)
|
|||
vf_admin->tx_rate)
|
||||
vf_admin->qos_vport = slave;
|
||||
|
||||
if (mlx4_master_immediate_activate_vlan_qos(priv, slave, port))
|
||||
/* Try to activate new vf state without restart,
|
||||
* this option is not supported while moving to VST QinQ mode.
|
||||
*/
|
||||
if ((proto == htons(ETH_P_8021AD) &&
|
||||
vf_oper->state.vlan_proto != proto) ||
|
||||
mlx4_master_immediate_activate_vlan_qos(priv, slave, port))
|
||||
mlx4_info(dev,
|
||||
"updating vf %d port %d config will take effect on next VF restart\n",
|
||||
vf, port);
|
||||
|
@ -3128,6 +3179,7 @@ int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_in
|
|||
|
||||
ivf->vlan = s_info->default_vlan;
|
||||
ivf->qos = s_info->default_qos;
|
||||
ivf->vlan_proto = s_info->vlan_proto;
|
||||
|
||||
if (mlx4_is_vf_vst_and_prio_qos(dev, port, s_info))
|
||||
ivf->max_tx_rate = s_info->tx_rate;
|
||||
|
|
|
@ -2400,12 +2400,14 @@ static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac)
|
|||
return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac_u64);
|
||||
}
|
||||
|
||||
static int mlx4_en_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos)
|
||||
static int mlx4_en_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct mlx4_en_priv *en_priv = netdev_priv(dev);
|
||||
struct mlx4_en_dev *mdev = en_priv->mdev;
|
||||
|
||||
return mlx4_set_vf_vlan(mdev->dev, en_priv->port, vf, vlan, qos);
|
||||
return mlx4_set_vf_vlan(mdev->dev, en_priv->port, vf, vlan, qos,
|
||||
vlan_proto);
|
||||
}
|
||||
|
||||
static int mlx4_en_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
|
||||
|
@ -3224,6 +3226,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
|||
}
|
||||
|
||||
if (mlx4_is_slave(mdev->dev)) {
|
||||
bool vlan_offload_disabled;
|
||||
int phv;
|
||||
|
||||
err = get_phv_bit(mdev->dev, port, &phv);
|
||||
|
@ -3231,6 +3234,18 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
|||
dev->hw_features |= NETIF_F_HW_VLAN_STAG_TX;
|
||||
priv->pflags |= MLX4_EN_PRIV_FLAGS_PHV;
|
||||
}
|
||||
err = mlx4_get_is_vlan_offload_disabled(mdev->dev, port,
|
||||
&vlan_offload_disabled);
|
||||
if (!err && vlan_offload_disabled) {
|
||||
dev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_TX |
|
||||
NETIF_F_HW_VLAN_STAG_RX);
|
||||
dev->features &= ~(NETIF_F_HW_VLAN_CTAG_TX |
|
||||
NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_TX |
|
||||
NETIF_F_HW_VLAN_STAG_RX);
|
||||
}
|
||||
} else {
|
||||
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN &&
|
||||
!(mdev->dev->caps.flags2 &
|
||||
|
|
|
@ -158,7 +158,8 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
|
|||
[31] = "Modifying loopback source checks using UPDATE_QP support",
|
||||
[32] = "Loopback source checks support",
|
||||
[33] = "RoCEv2 support",
|
||||
[34] = "DMFS Sniffer support (UC & MC)"
|
||||
[34] = "DMFS Sniffer support (UC & MC)",
|
||||
[35] = "QinQ VST mode support",
|
||||
};
|
||||
int i;
|
||||
|
||||
|
@ -248,6 +249,72 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int mlx4_activate_vst_qinq(struct mlx4_priv *priv, int slave, int port)
|
||||
{
|
||||
struct mlx4_vport_oper_state *vp_oper;
|
||||
struct mlx4_vport_state *vp_admin;
|
||||
int err;
|
||||
|
||||
vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
|
||||
vp_admin = &priv->mfunc.master.vf_admin[slave].vport[port];
|
||||
|
||||
if (vp_admin->default_vlan != vp_oper->state.default_vlan) {
|
||||
err = __mlx4_register_vlan(&priv->dev, port,
|
||||
vp_admin->default_vlan,
|
||||
&vp_oper->vlan_idx);
|
||||
if (err) {
|
||||
vp_oper->vlan_idx = NO_INDX;
|
||||
mlx4_warn(&priv->dev,
|
||||
"No vlan resources slave %d, port %d\n",
|
||||
slave, port);
|
||||
return err;
|
||||
}
|
||||
mlx4_dbg(&priv->dev, "alloc vlan %d idx %d slave %d port %d\n",
|
||||
(int)(vp_oper->state.default_vlan),
|
||||
vp_oper->vlan_idx, slave, port);
|
||||
}
|
||||
vp_oper->state.vlan_proto = vp_admin->vlan_proto;
|
||||
vp_oper->state.default_vlan = vp_admin->default_vlan;
|
||||
vp_oper->state.default_qos = vp_admin->default_qos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx4_handle_vst_qinq(struct mlx4_priv *priv, int slave, int port)
|
||||
{
|
||||
struct mlx4_vport_oper_state *vp_oper;
|
||||
struct mlx4_slave_state *slave_state;
|
||||
struct mlx4_vport_state *vp_admin;
|
||||
int err;
|
||||
|
||||
vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
|
||||
vp_admin = &priv->mfunc.master.vf_admin[slave].vport[port];
|
||||
slave_state = &priv->mfunc.master.slave_state[slave];
|
||||
|
||||
if ((vp_admin->vlan_proto != htons(ETH_P_8021AD)) ||
|
||||
(!slave_state->active))
|
||||
return 0;
|
||||
|
||||
if (vp_oper->state.vlan_proto == vp_admin->vlan_proto &&
|
||||
vp_oper->state.default_vlan == vp_admin->default_vlan &&
|
||||
vp_oper->state.default_qos == vp_admin->default_qos)
|
||||
return 0;
|
||||
|
||||
if (!slave_state->vst_qinq_supported) {
|
||||
/* Warn and revert the request to set vst QinQ mode */
|
||||
vp_admin->vlan_proto = vp_oper->state.vlan_proto;
|
||||
vp_admin->default_vlan = vp_oper->state.default_vlan;
|
||||
vp_admin->default_qos = vp_oper->state.default_qos;
|
||||
|
||||
mlx4_warn(&priv->dev,
|
||||
"Slave %d does not support VST QinQ mode\n", slave);
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = mlx4_activate_vst_qinq(priv, slave, port);
|
||||
return err;
|
||||
}
|
||||
|
||||
int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
|
||||
struct mlx4_vhcr *vhcr,
|
||||
struct mlx4_cmd_mailbox *inbox,
|
||||
|
@ -311,14 +378,18 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
|
|||
#define QUERY_FUNC_CAP_VF_ENABLE_QP0 0x08
|
||||
|
||||
#define QUERY_FUNC_CAP_FLAGS0_FORCE_PHY_WQE_GID 0x80
|
||||
#define QUERY_FUNC_CAP_SUPPORTS_NON_POWER_OF_2_NUM_EQS (1 << 31)
|
||||
#define QUERY_FUNC_CAP_PHV_BIT 0x40
|
||||
#define QUERY_FUNC_CAP_VLAN_OFFLOAD_DISABLE 0x20
|
||||
|
||||
#define QUERY_FUNC_CAP_SUPPORTS_VST_QINQ BIT(30)
|
||||
#define QUERY_FUNC_CAP_SUPPORTS_NON_POWER_OF_2_NUM_EQS BIT(31)
|
||||
|
||||
if (vhcr->op_modifier == 1) {
|
||||
struct mlx4_active_ports actv_ports =
|
||||
mlx4_get_active_ports(dev, slave);
|
||||
int converted_port = mlx4_slave_convert_port(
|
||||
dev, slave, vhcr->in_modifier);
|
||||
struct mlx4_vport_oper_state *vp_oper;
|
||||
|
||||
if (converted_port < 0)
|
||||
return -EINVAL;
|
||||
|
@ -357,15 +428,24 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
|
|||
MLX4_PUT(outbox->buf, dev->caps.phys_port_id[vhcr->in_modifier],
|
||||
QUERY_FUNC_CAP_PHYS_PORT_ID);
|
||||
|
||||
if (dev->caps.phv_bit[port]) {
|
||||
field = QUERY_FUNC_CAP_PHV_BIT;
|
||||
MLX4_PUT(outbox->buf, field,
|
||||
QUERY_FUNC_CAP_FLAGS0_OFFSET);
|
||||
}
|
||||
vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
|
||||
err = mlx4_handle_vst_qinq(priv, slave, port);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
field = 0;
|
||||
if (dev->caps.phv_bit[port])
|
||||
field |= QUERY_FUNC_CAP_PHV_BIT;
|
||||
if (vp_oper->state.vlan_proto == htons(ETH_P_8021AD))
|
||||
field |= QUERY_FUNC_CAP_VLAN_OFFLOAD_DISABLE;
|
||||
MLX4_PUT(outbox->buf, field, QUERY_FUNC_CAP_FLAGS0_OFFSET);
|
||||
|
||||
} else if (vhcr->op_modifier == 0) {
|
||||
struct mlx4_active_ports actv_ports =
|
||||
mlx4_get_active_ports(dev, slave);
|
||||
struct mlx4_slave_state *slave_state =
|
||||
&priv->mfunc.master.slave_state[slave];
|
||||
|
||||
/* enable rdma and ethernet interfaces, new quota locations,
|
||||
* and reserved lkey
|
||||
*/
|
||||
|
@ -439,6 +519,10 @@ int mlx4_QUERY_FUNC_CAP_wrapper(struct mlx4_dev *dev, int slave,
|
|||
|
||||
size = dev->caps.reserved_lkey + ((slave << 8) & 0xFF00);
|
||||
MLX4_PUT(outbox->buf, size, QUERY_FUNC_CAP_QP_RESD_LKEY_OFFSET);
|
||||
|
||||
if (vhcr->in_modifier & QUERY_FUNC_CAP_SUPPORTS_VST_QINQ)
|
||||
slave_state->vst_qinq_supported = true;
|
||||
|
||||
} else
|
||||
err = -EINVAL;
|
||||
|
||||
|
@ -454,10 +538,12 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port,
|
|||
u32 size, qkey;
|
||||
int err = 0, quotas = 0;
|
||||
u32 in_modifier;
|
||||
u32 slave_caps;
|
||||
|
||||
op_modifier = !!gen_or_port; /* 0 = general, 1 = logical port */
|
||||
in_modifier = op_modifier ? gen_or_port :
|
||||
slave_caps = QUERY_FUNC_CAP_SUPPORTS_VST_QINQ |
|
||||
QUERY_FUNC_CAP_SUPPORTS_NON_POWER_OF_2_NUM_EQS;
|
||||
in_modifier = op_modifier ? gen_or_port : slave_caps;
|
||||
|
||||
mailbox = mlx4_alloc_cmd_mailbox(dev);
|
||||
if (IS_ERR(mailbox))
|
||||
|
@ -612,8 +698,7 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port,
|
|||
MLX4_GET(func_cap->phys_port_id, outbox,
|
||||
QUERY_FUNC_CAP_PHYS_PORT_ID);
|
||||
|
||||
MLX4_GET(field, outbox, QUERY_FUNC_CAP_FLAGS0_OFFSET);
|
||||
func_cap->flags |= (field & QUERY_FUNC_CAP_PHV_BIT);
|
||||
MLX4_GET(func_cap->flags0, outbox, QUERY_FUNC_CAP_FLAGS0_OFFSET);
|
||||
|
||||
/* All other resources are allocated by the master, but we still report
|
||||
* 'num' and 'reserved' capabilities as follows:
|
||||
|
@ -690,6 +775,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
|
|||
#define QUERY_DEV_CAP_MAX_DESC_SZ_SQ_OFFSET 0x52
|
||||
#define QUERY_DEV_CAP_MAX_SG_RQ_OFFSET 0x55
|
||||
#define QUERY_DEV_CAP_MAX_DESC_SZ_RQ_OFFSET 0x56
|
||||
#define QUERY_DEV_CAP_SVLAN_BY_QP_OFFSET 0x5D
|
||||
#define QUERY_DEV_CAP_MAX_QP_MCG_OFFSET 0x61
|
||||
#define QUERY_DEV_CAP_RSVD_MCG_OFFSET 0x62
|
||||
#define QUERY_DEV_CAP_MAX_MCG_OFFSET 0x63
|
||||
|
@ -857,6 +943,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
|
|||
MLX4_GET(size, outbox, QUERY_DEV_CAP_MAX_DESC_SZ_SQ_OFFSET);
|
||||
dev_cap->max_sq_desc_sz = size;
|
||||
|
||||
MLX4_GET(field, outbox, QUERY_DEV_CAP_SVLAN_BY_QP_OFFSET);
|
||||
if (field & 0x1)
|
||||
dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP;
|
||||
MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_MCG_OFFSET);
|
||||
dev_cap->max_qp_per_mcg = 1 << field;
|
||||
MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MCG_OFFSET);
|
||||
|
@ -2914,7 +3003,7 @@ int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv)
|
|||
memset(&func_cap, 0, sizeof(func_cap));
|
||||
err = mlx4_QUERY_FUNC_CAP(dev, port, &func_cap);
|
||||
if (!err)
|
||||
*phv = func_cap.flags & QUERY_FUNC_CAP_PHV_BIT;
|
||||
*phv = func_cap.flags0 & QUERY_FUNC_CAP_PHV_BIT;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(get_phv_bit);
|
||||
|
@ -2938,6 +3027,22 @@ int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val)
|
|||
}
|
||||
EXPORT_SYMBOL(set_phv_bit);
|
||||
|
||||
int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port,
|
||||
bool *vlan_offload_disabled)
|
||||
{
|
||||
struct mlx4_func_cap func_cap;
|
||||
int err;
|
||||
|
||||
memset(&func_cap, 0, sizeof(func_cap));
|
||||
err = mlx4_QUERY_FUNC_CAP(dev, port, &func_cap);
|
||||
if (!err)
|
||||
*vlan_offload_disabled =
|
||||
!!(func_cap.flags0 &
|
||||
QUERY_FUNC_CAP_VLAN_OFFLOAD_DISABLE);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(mlx4_get_is_vlan_offload_disabled);
|
||||
|
||||
void mlx4_replace_zero_macs(struct mlx4_dev *dev)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -152,7 +152,7 @@ struct mlx4_func_cap {
|
|||
u32 qp1_proxy_qpn;
|
||||
u32 reserved_lkey;
|
||||
u8 physical_port;
|
||||
u8 port_flags;
|
||||
u8 flags0;
|
||||
u8 flags1;
|
||||
u64 phys_port_id;
|
||||
u32 extra_flags;
|
||||
|
|
|
@ -483,6 +483,7 @@ struct mlx4_slave_state {
|
|||
u8 init_port_mask;
|
||||
bool active;
|
||||
bool old_vlan_api;
|
||||
bool vst_qinq_supported;
|
||||
u8 function;
|
||||
dma_addr_t vhcr_dma;
|
||||
u16 mtu[MLX4_MAX_PORTS + 1];
|
||||
|
@ -508,6 +509,7 @@ struct mlx4_vport_state {
|
|||
u64 mac;
|
||||
u16 default_vlan;
|
||||
u8 default_qos;
|
||||
__be16 vlan_proto;
|
||||
u32 tx_rate;
|
||||
bool spoofchk;
|
||||
u32 link_state;
|
||||
|
@ -657,6 +659,7 @@ struct mlx4_vf_immed_vlan_work {
|
|||
u8 qos_vport;
|
||||
u16 vlan_id;
|
||||
u16 orig_vlan_id;
|
||||
__be16 vlan_proto;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -790,10 +790,22 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
|
|||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED;
|
||||
} else if (0 != vp_oper->state.default_vlan) {
|
||||
qpc->pri_path.vlan_control |=
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
|
||||
if (vp_oper->state.vlan_proto == htons(ETH_P_8021AD)) {
|
||||
/* vst QinQ should block untagged on TX,
|
||||
* but cvlan is in payload and phv is set so
|
||||
* hw see it as untagged. Block tagged instead.
|
||||
*/
|
||||
qpc->pri_path.vlan_control |=
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
|
||||
} else { /* vst 802.1Q */
|
||||
qpc->pri_path.vlan_control |=
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
|
||||
}
|
||||
} else { /* priority tagged */
|
||||
qpc->pri_path.vlan_control |=
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
|
@ -802,7 +814,11 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
|
|||
|
||||
qpc->pri_path.fvl_rx |= MLX4_FVL_RX_FORCE_ETH_VLAN;
|
||||
qpc->pri_path.vlan_index = vp_oper->vlan_idx;
|
||||
qpc->pri_path.fl |= MLX4_FL_CV | MLX4_FL_ETH_HIDE_CQE_VLAN;
|
||||
qpc->pri_path.fl |= MLX4_FL_ETH_HIDE_CQE_VLAN;
|
||||
if (vp_oper->state.vlan_proto == htons(ETH_P_8021AD))
|
||||
qpc->pri_path.fl |= MLX4_FL_SV;
|
||||
else
|
||||
qpc->pri_path.fl |= MLX4_FL_CV;
|
||||
qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN;
|
||||
qpc->pri_path.sched_queue &= 0xC7;
|
||||
qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3;
|
||||
|
@ -5238,6 +5254,7 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
|
|||
u64 qp_path_mask = ((1ULL << MLX4_UPD_QP_PATH_MASK_VLAN_INDEX) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_FVL) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_CV) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_SV) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_FEUP) |
|
||||
(1ULL << MLX4_UPD_QP_PATH_MASK_FVL_RX) |
|
||||
|
@ -5266,7 +5283,12 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
|
|||
else if (!work->vlan_id)
|
||||
vlan_control = MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED;
|
||||
else
|
||||
else if (work->vlan_proto == htons(ETH_P_8021AD))
|
||||
vlan_control = MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
|
||||
else /* vst 802.1Q */
|
||||
vlan_control = MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED |
|
||||
MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
|
||||
|
@ -5311,7 +5333,11 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
|
|||
upd_context->qp_context.pri_path.fvl_rx =
|
||||
qp->fvl_rx | MLX4_FVL_RX_FORCE_ETH_VLAN;
|
||||
upd_context->qp_context.pri_path.fl =
|
||||
qp->pri_path_fl | MLX4_FL_CV | MLX4_FL_ETH_HIDE_CQE_VLAN;
|
||||
qp->pri_path_fl | MLX4_FL_ETH_HIDE_CQE_VLAN;
|
||||
if (work->vlan_proto == htons(ETH_P_8021AD))
|
||||
upd_context->qp_context.pri_path.fl |= MLX4_FL_SV;
|
||||
else
|
||||
upd_context->qp_context.pri_path.fl |= MLX4_FL_CV;
|
||||
upd_context->qp_context.pri_path.feup =
|
||||
qp->feup | MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN;
|
||||
upd_context->qp_context.pri_path.sched_queue =
|
||||
|
|
|
@ -2917,11 +2917,15 @@ static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
|
|||
return mlx5_eswitch_set_vport_mac(mdev->priv.eswitch, vf + 1, mac);
|
||||
}
|
||||
|
||||
static int mlx5e_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos)
|
||||
static int mlx5e_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct mlx5e_priv *priv = netdev_priv(dev);
|
||||
struct mlx5_core_dev *mdev = priv->mdev;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
return mlx5_eswitch_set_vport_vlan(mdev->priv.eswitch, vf + 1,
|
||||
vlan, qos);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,8 @@ static int qede_alloc_rx_buffer(struct qede_dev *edev,
|
|||
static void qede_link_update(void *dev, struct qed_link_output *link);
|
||||
|
||||
#ifdef CONFIG_QED_SRIOV
|
||||
static int qede_set_vf_vlan(struct net_device *ndev, int vf, u16 vlan, u8 qos)
|
||||
static int qede_set_vf_vlan(struct net_device *ndev, int vf, u16 vlan, u8 qos,
|
||||
__be16 vlan_proto)
|
||||
{
|
||||
struct qede_dev *edev = netdev_priv(ndev);
|
||||
|
||||
|
@ -109,6 +110,9 @@ static int qede_set_vf_vlan(struct net_device *ndev, int vf, u16 vlan, u8 qos)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
DP_VERBOSE(edev, QED_MSG_IOV, "Setting Vlan 0x%04x to VF [%d]\n",
|
||||
vlan, vf);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ int qlcnic_sriov_set_vf_mac(struct net_device *, int, u8 *);
|
|||
int qlcnic_sriov_set_vf_tx_rate(struct net_device *, int, int, int);
|
||||
int qlcnic_sriov_get_vf_config(struct net_device *, int ,
|
||||
struct ifla_vf_info *);
|
||||
int qlcnic_sriov_set_vf_vlan(struct net_device *, int, u16, u8);
|
||||
int qlcnic_sriov_set_vf_vlan(struct net_device *, int, u16, u8, __be16);
|
||||
int qlcnic_sriov_set_vf_spoofchk(struct net_device *, int, bool);
|
||||
#else
|
||||
static inline void qlcnic_sriov_pf_disable(struct qlcnic_adapter *adapter) {}
|
||||
|
|
|
@ -1915,7 +1915,7 @@ int qlcnic_sriov_set_vf_tx_rate(struct net_device *netdev, int vf,
|
|||
}
|
||||
|
||||
int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf,
|
||||
u16 vlan, u8 qos)
|
||||
u16 vlan, u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
struct qlcnic_adapter *adapter = netdev_priv(netdev);
|
||||
struct qlcnic_sriov *sriov = adapter->ahw->sriov;
|
||||
|
@ -1928,6 +1928,9 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf,
|
|||
if (vf >= sriov->num_vfs || qos > 7)
|
||||
return -EINVAL;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
if (vlan > MAX_VLAN_ID) {
|
||||
netdev_err(netdev,
|
||||
"Invalid VLAN ID, allowed range is [0 - %d]\n",
|
||||
|
|
|
@ -22,7 +22,7 @@ int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)
|
|||
}
|
||||
|
||||
int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
|
||||
u8 qos)
|
||||
u8 qos, __be16 vlan_proto)
|
||||
{
|
||||
struct efx_nic *efx = netdev_priv(net_dev);
|
||||
|
||||
|
@ -31,6 +31,9 @@ int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
|
|||
(qos & ~(VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT)))
|
||||
return -EINVAL;
|
||||
|
||||
if (vlan_proto != htons(ETH_P_8021Q))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
return efx->type->sriov_set_vf_vlan(efx, vf_i, vlan, qos);
|
||||
} else {
|
||||
return -EOPNOTSUPP;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac);
|
||||
int efx_sriov_set_vf_vlan(struct net_device *net_dev, int vf_i, u16 vlan,
|
||||
u8 qos);
|
||||
u8 qos, __be16 vlan_proto);
|
||||
int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf_i,
|
||||
bool spoofchk);
|
||||
int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
|
||||
|
|
|
@ -25,5 +25,6 @@ struct ifla_vf_info {
|
|||
__u32 max_tx_rate;
|
||||
__u32 rss_query_en;
|
||||
__u32 trusted;
|
||||
__be16 vlan_proto;
|
||||
};
|
||||
#endif /* _LINUX_IF_LINK_H */
|
||||
|
|
|
@ -309,7 +309,8 @@ int mlx4_get_vf_stats(struct mlx4_dev *dev, int port, int vf_idx,
|
|||
struct ifla_vf_stats *vf_stats);
|
||||
u32 mlx4_comm_get_version(void);
|
||||
int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
|
||||
int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
|
||||
int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan,
|
||||
u8 qos, __be16 proto);
|
||||
int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
|
||||
int max_tx_rate);
|
||||
int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
|
||||
|
|
|
@ -221,6 +221,7 @@ enum {
|
|||
MLX4_DEV_CAP_FLAG2_ROCE_V1_V2 = 1ULL << 33,
|
||||
MLX4_DEV_CAP_FLAG2_DMFS_UC_MC_SNIFFER = 1ULL << 34,
|
||||
MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT = 1ULL << 35,
|
||||
MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP = 1ULL << 36,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -1371,6 +1372,8 @@ int mlx4_SET_PORT_fcs_check(struct mlx4_dev *dev, u8 port,
|
|||
int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
|
||||
int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val);
|
||||
int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv);
|
||||
int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port,
|
||||
bool *vlan_offload_disabled);
|
||||
int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
|
||||
int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
|
||||
int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
|
||||
|
|
|
@ -160,6 +160,7 @@ struct mlx4_qp_path {
|
|||
|
||||
enum { /* fl */
|
||||
MLX4_FL_CV = 1 << 6,
|
||||
MLX4_FL_SV = 1 << 5,
|
||||
MLX4_FL_ETH_HIDE_CQE_VLAN = 1 << 2,
|
||||
MLX4_FL_ETH_SRC_CHECK_MC_LB = 1 << 1,
|
||||
MLX4_FL_ETH_SRC_CHECK_UC_LB = 1 << 0,
|
||||
|
@ -267,6 +268,7 @@ enum {
|
|||
MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
|
||||
MLX4_UPD_QP_PATH_MASK_ETH_SRC_CHECK_UC_LB = 18 + 32,
|
||||
MLX4_UPD_QP_PATH_MASK_ETH_SRC_CHECK_MC_LB = 19 + 32,
|
||||
MLX4_UPD_QP_PATH_MASK_SV = 22 + 32,
|
||||
};
|
||||
|
||||
enum { /* param3 */
|
||||
|
|
|
@ -946,7 +946,8 @@ struct netdev_xdp {
|
|||
*
|
||||
* SR-IOV management functions.
|
||||
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
|
||||
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
|
||||
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan,
|
||||
* u8 qos, __be16 proto);
|
||||
* int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
|
||||
* int max_tx_rate);
|
||||
* int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
|
||||
|
@ -1187,7 +1188,8 @@ struct net_device_ops {
|
|||
int (*ndo_set_vf_mac)(struct net_device *dev,
|
||||
int queue, u8 *mac);
|
||||
int (*ndo_set_vf_vlan)(struct net_device *dev,
|
||||
int queue, u16 vlan, u8 qos);
|
||||
int queue, u16 vlan,
|
||||
u8 qos, __be16 proto);
|
||||
int (*ndo_set_vf_rate)(struct net_device *dev,
|
||||
int vf, int min_tx_rate,
|
||||
int max_tx_rate);
|
||||
|
|
|
@ -619,7 +619,7 @@ enum {
|
|||
enum {
|
||||
IFLA_VF_UNSPEC,
|
||||
IFLA_VF_MAC, /* Hardware queue specific attributes */
|
||||
IFLA_VF_VLAN,
|
||||
IFLA_VF_VLAN, /* VLAN ID and QoS */
|
||||
IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */
|
||||
IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
|
||||
IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
|
||||
|
@ -631,6 +631,7 @@ enum {
|
|||
IFLA_VF_TRUST, /* Trust VF */
|
||||
IFLA_VF_IB_NODE_GUID, /* VF Infiniband node GUID */
|
||||
IFLA_VF_IB_PORT_GUID, /* VF Infiniband port GUID */
|
||||
IFLA_VF_VLAN_LIST, /* nested list of vlans, option for QinQ */
|
||||
__IFLA_VF_MAX,
|
||||
};
|
||||
|
||||
|
@ -647,6 +648,22 @@ struct ifla_vf_vlan {
|
|||
__u32 qos;
|
||||
};
|
||||
|
||||
enum {
|
||||
IFLA_VF_VLAN_INFO_UNSPEC,
|
||||
IFLA_VF_VLAN_INFO, /* VLAN ID, QoS and VLAN protocol */
|
||||
__IFLA_VF_VLAN_INFO_MAX,
|
||||
};
|
||||
|
||||
#define IFLA_VF_VLAN_INFO_MAX (__IFLA_VF_VLAN_INFO_MAX - 1)
|
||||
#define MAX_VLAN_LIST_LEN 1
|
||||
|
||||
struct ifla_vf_vlan_info {
|
||||
__u32 vf;
|
||||
__u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
|
||||
__u32 qos;
|
||||
__be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */
|
||||
};
|
||||
|
||||
struct ifla_vf_tx_rate {
|
||||
__u32 vf;
|
||||
__u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
|
||||
|
|
|
@ -843,7 +843,10 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
|
|||
size += nla_total_size(num_vfs * sizeof(struct nlattr));
|
||||
size += num_vfs *
|
||||
(nla_total_size(sizeof(struct ifla_vf_mac)) +
|
||||
nla_total_size(sizeof(struct ifla_vf_vlan)) +
|
||||
nla_total_size(MAX_VLAN_LIST_LEN *
|
||||
sizeof(struct nlattr)) +
|
||||
nla_total_size(MAX_VLAN_LIST_LEN *
|
||||
sizeof(struct ifla_vf_vlan_info)) +
|
||||
nla_total_size(sizeof(struct ifla_vf_spoofchk)) +
|
||||
nla_total_size(sizeof(struct ifla_vf_rate)) +
|
||||
nla_total_size(sizeof(struct ifla_vf_link_state)) +
|
||||
|
@ -1111,14 +1114,15 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
struct nlattr *vfinfo)
|
||||
{
|
||||
struct ifla_vf_rss_query_en vf_rss_query_en;
|
||||
struct nlattr *vf, *vfstats, *vfvlanlist;
|
||||
struct ifla_vf_link_state vf_linkstate;
|
||||
struct ifla_vf_vlan_info vf_vlan_info;
|
||||
struct ifla_vf_spoofchk vf_spoofchk;
|
||||
struct ifla_vf_tx_rate vf_tx_rate;
|
||||
struct ifla_vf_stats vf_stats;
|
||||
struct ifla_vf_trust vf_trust;
|
||||
struct ifla_vf_vlan vf_vlan;
|
||||
struct ifla_vf_rate vf_rate;
|
||||
struct nlattr *vf, *vfstats;
|
||||
struct ifla_vf_mac vf_mac;
|
||||
struct ifla_vf_info ivi;
|
||||
|
||||
|
@ -1135,11 +1139,14 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
* IFLA_VF_LINK_STATE_AUTO which equals zero
|
||||
*/
|
||||
ivi.linkstate = 0;
|
||||
/* VLAN Protocol by default is 802.1Q */
|
||||
ivi.vlan_proto = htons(ETH_P_8021Q);
|
||||
if (dev->netdev_ops->ndo_get_vf_config(dev, vfs_num, &ivi))
|
||||
return 0;
|
||||
|
||||
vf_mac.vf =
|
||||
vf_vlan.vf =
|
||||
vf_vlan_info.vf =
|
||||
vf_rate.vf =
|
||||
vf_tx_rate.vf =
|
||||
vf_spoofchk.vf =
|
||||
|
@ -1150,6 +1157,9 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac));
|
||||
vf_vlan.vlan = ivi.vlan;
|
||||
vf_vlan.qos = ivi.qos;
|
||||
vf_vlan_info.vlan = ivi.vlan;
|
||||
vf_vlan_info.qos = ivi.qos;
|
||||
vf_vlan_info.vlan_proto = ivi.vlan_proto;
|
||||
vf_tx_rate.rate = ivi.max_tx_rate;
|
||||
vf_rate.min_tx_rate = ivi.min_tx_rate;
|
||||
vf_rate.max_tx_rate = ivi.max_tx_rate;
|
||||
|
@ -1158,10 +1168,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
vf_rss_query_en.setting = ivi.rss_query_en;
|
||||
vf_trust.setting = ivi.trusted;
|
||||
vf = nla_nest_start(skb, IFLA_VF_INFO);
|
||||
if (!vf) {
|
||||
nla_nest_cancel(skb, vfinfo);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
if (!vf)
|
||||
goto nla_put_vfinfo_failure;
|
||||
if (nla_put(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac) ||
|
||||
nla_put(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan) ||
|
||||
nla_put(skb, IFLA_VF_RATE, sizeof(vf_rate),
|
||||
|
@ -1177,17 +1185,23 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
&vf_rss_query_en) ||
|
||||
nla_put(skb, IFLA_VF_TRUST,
|
||||
sizeof(vf_trust), &vf_trust))
|
||||
return -EMSGSIZE;
|
||||
goto nla_put_vf_failure;
|
||||
vfvlanlist = nla_nest_start(skb, IFLA_VF_VLAN_LIST);
|
||||
if (!vfvlanlist)
|
||||
goto nla_put_vf_failure;
|
||||
if (nla_put(skb, IFLA_VF_VLAN_INFO, sizeof(vf_vlan_info),
|
||||
&vf_vlan_info)) {
|
||||
nla_nest_cancel(skb, vfvlanlist);
|
||||
goto nla_put_vf_failure;
|
||||
}
|
||||
nla_nest_end(skb, vfvlanlist);
|
||||
memset(&vf_stats, 0, sizeof(vf_stats));
|
||||
if (dev->netdev_ops->ndo_get_vf_stats)
|
||||
dev->netdev_ops->ndo_get_vf_stats(dev, vfs_num,
|
||||
&vf_stats);
|
||||
vfstats = nla_nest_start(skb, IFLA_VF_STATS);
|
||||
if (!vfstats) {
|
||||
nla_nest_cancel(skb, vf);
|
||||
nla_nest_cancel(skb, vfinfo);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
if (!vfstats)
|
||||
goto nla_put_vf_failure;
|
||||
if (nla_put_u64_64bit(skb, IFLA_VF_STATS_RX_PACKETS,
|
||||
vf_stats.rx_packets, IFLA_VF_STATS_PAD) ||
|
||||
nla_put_u64_64bit(skb, IFLA_VF_STATS_TX_PACKETS,
|
||||
|
@ -1199,11 +1213,19 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
|
|||
nla_put_u64_64bit(skb, IFLA_VF_STATS_BROADCAST,
|
||||
vf_stats.broadcast, IFLA_VF_STATS_PAD) ||
|
||||
nla_put_u64_64bit(skb, IFLA_VF_STATS_MULTICAST,
|
||||
vf_stats.multicast, IFLA_VF_STATS_PAD))
|
||||
return -EMSGSIZE;
|
||||
vf_stats.multicast, IFLA_VF_STATS_PAD)) {
|
||||
nla_nest_cancel(skb, vfstats);
|
||||
goto nla_put_vf_failure;
|
||||
}
|
||||
nla_nest_end(skb, vfstats);
|
||||
nla_nest_end(skb, vf);
|
||||
return 0;
|
||||
|
||||
nla_put_vf_failure:
|
||||
nla_nest_cancel(skb, vf);
|
||||
nla_put_vfinfo_failure:
|
||||
nla_nest_cancel(skb, vfinfo);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)
|
||||
|
@ -1448,6 +1470,7 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
|
|||
static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
|
||||
[IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) },
|
||||
[IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) },
|
||||
[IFLA_VF_VLAN_LIST] = { .type = NLA_NESTED },
|
||||
[IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) },
|
||||
[IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) },
|
||||
[IFLA_VF_RATE] = { .len = sizeof(struct ifla_vf_rate) },
|
||||
|
@ -1704,7 +1727,34 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
|
|||
err = -EOPNOTSUPP;
|
||||
if (ops->ndo_set_vf_vlan)
|
||||
err = ops->ndo_set_vf_vlan(dev, ivv->vf, ivv->vlan,
|
||||
ivv->qos);
|
||||
ivv->qos,
|
||||
htons(ETH_P_8021Q));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (tb[IFLA_VF_VLAN_LIST]) {
|
||||
struct ifla_vf_vlan_info *ivvl[MAX_VLAN_LIST_LEN];
|
||||
struct nlattr *attr;
|
||||
int rem, len = 0;
|
||||
|
||||
err = -EOPNOTSUPP;
|
||||
if (!ops->ndo_set_vf_vlan)
|
||||
return err;
|
||||
|
||||
nla_for_each_nested(attr, tb[IFLA_VF_VLAN_LIST], rem) {
|
||||
if (nla_type(attr) != IFLA_VF_VLAN_INFO ||
|
||||
nla_len(attr) < NLA_HDRLEN) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (len >= MAX_VLAN_LIST_LEN)
|
||||
return -EOPNOTSUPP;
|
||||
ivvl[len] = nla_data(attr);
|
||||
|
||||
len++;
|
||||
}
|
||||
err = ops->ndo_set_vf_vlan(dev, ivvl[0]->vf, ivvl[0]->vlan,
|
||||
ivvl[0]->qos, ivvl[0]->vlan_proto);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue