diff options
author | Rony Efraim <ronye@mellanox.com> | 2013-04-25 01:22:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-26 23:29:14 -0400 |
commit | 2cccb9e4f3476da916146c2ec571c4f3eff738b1 (patch) | |
tree | 79524a1d906c0ab14331dea45e364f600c42b355 /drivers/net/ethernet/mellanox/mlx4/cmd.c | |
parent | e6b6a2316379feebebacec0979b3ebc5743e7502 (diff) |
net/mlx4: Add support to get VF config
Support getting VF config.
Signed-off-by: Rony Efraim <ronye@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/cmd.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index eda347eeb5dc..1df56cc50ee9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -2151,3 +2151,36 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) | |||
2151 | return 0; | 2151 | return 0; |
2152 | } | 2152 | } |
2153 | EXPORT_SYMBOL_GPL(mlx4_set_vf_spoofchk); | 2153 | EXPORT_SYMBOL_GPL(mlx4_set_vf_spoofchk); |
2154 | |||
2155 | int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf) | ||
2156 | { | ||
2157 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
2158 | struct mlx4_vport_state *s_info; | ||
2159 | int slave; | ||
2160 | |||
2161 | if (!mlx4_is_master(dev)) | ||
2162 | return -EPROTONOSUPPORT; | ||
2163 | |||
2164 | slave = mlx4_get_slave_indx(dev, vf); | ||
2165 | if (slave < 0) | ||
2166 | return -EINVAL; | ||
2167 | |||
2168 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | ||
2169 | ivf->vf = vf; | ||
2170 | |||
2171 | /* need to convert it to a func */ | ||
2172 | ivf->mac[0] = ((s_info->mac >> (5*8)) & 0xff); | ||
2173 | ivf->mac[1] = ((s_info->mac >> (4*8)) & 0xff); | ||
2174 | ivf->mac[2] = ((s_info->mac >> (3*8)) & 0xff); | ||
2175 | ivf->mac[3] = ((s_info->mac >> (2*8)) & 0xff); | ||
2176 | ivf->mac[4] = ((s_info->mac >> (1*8)) & 0xff); | ||
2177 | ivf->mac[5] = ((s_info->mac) & 0xff); | ||
2178 | |||
2179 | ivf->vlan = s_info->default_vlan; | ||
2180 | ivf->qos = s_info->default_qos; | ||
2181 | ivf->tx_rate = s_info->tx_rate; | ||
2182 | ivf->spoofchk = s_info->spoofchk; | ||
2183 | |||
2184 | return 0; | ||
2185 | } | ||
2186 | EXPORT_SYMBOL_GPL(mlx4_get_vf_config); | ||