Commit e65ade77 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlx4-misc-fixes'

Tariq Toukan says:

====================
mlx4 misc fixes

This patchset contains misc bug fixes from Eric Dumazet and our team
to the mlx4 Core and Eth drivers.

Series generated against net commit:
eee2faab tcp: account for ts offset only if tsecr not zero

v3:
* Rebased, conflict solved.

v2:
* Added Eric's fix (patch 5/5).
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c12f4d76 7f0137e2
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <rdma/ib_smi.h> #include <rdma/ib_smi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/etherdevice.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -2955,7 +2956,7 @@ static bool mlx4_valid_vf_state_change(struct mlx4_dev *dev, int port, ...@@ -2955,7 +2956,7 @@ static bool mlx4_valid_vf_state_change(struct mlx4_dev *dev, int port,
return false; return false;
} }
int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac)
{ {
struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_vport_state *s_info; struct mlx4_vport_state *s_info;
...@@ -2964,13 +2965,22 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) ...@@ -2964,13 +2965,22 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
if (!mlx4_is_master(dev)) if (!mlx4_is_master(dev))
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
if (is_multicast_ether_addr(mac))
return -EINVAL;
slave = mlx4_get_slave_indx(dev, vf); slave = mlx4_get_slave_indx(dev, vf);
if (slave < 0) if (slave < 0)
return -EINVAL; return -EINVAL;
port = mlx4_slaves_closest_port(dev, slave, port); port = mlx4_slaves_closest_port(dev, slave, port);
s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
s_info->mac = mac;
if (s_info->spoofchk && is_zero_ether_addr(mac)) {
mlx4_info(dev, "MAC invalidation is not allowed when spoofchk is on\n");
return -EPERM;
}
s_info->mac = mlx4_mac_to_u64(mac);
mlx4_info(dev, "default mac on vf %d port %d to %llX will take effect only after vf restart\n", mlx4_info(dev, "default mac on vf %d port %d to %llX will take effect only after vf restart\n",
vf, port, s_info->mac); vf, port, s_info->mac);
return 0; return 0;
...@@ -3143,6 +3153,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) ...@@ -3143,6 +3153,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting)
struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_vport_state *s_info; struct mlx4_vport_state *s_info;
int slave; int slave;
u8 mac[ETH_ALEN];
if ((!mlx4_is_master(dev)) || if ((!mlx4_is_master(dev)) ||
!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FSM)) !(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FSM))
...@@ -3154,6 +3165,13 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) ...@@ -3154,6 +3165,13 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting)
port = mlx4_slaves_closest_port(dev, slave, port); port = mlx4_slaves_closest_port(dev, slave, port);
s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
mlx4_u64_to_mac(mac, s_info->mac);
if (setting && !is_valid_ether_addr(mac)) {
mlx4_info(dev, "Illegal MAC with spoofchk\n");
return -EPERM;
}
s_info->spoofchk = setting; s_info->spoofchk = setting;
return 0; return 0;
......
...@@ -319,7 +319,7 @@ static int mlx4_en_ets_validate(struct mlx4_en_priv *priv, struct ieee_ets *ets) ...@@ -319,7 +319,7 @@ static int mlx4_en_ets_validate(struct mlx4_en_priv *priv, struct ieee_ets *ets)
default: default:
en_err(priv, "TC[%d]: Not supported TSA: %d\n", en_err(priv, "TC[%d]: Not supported TSA: %d\n",
i, ets->tc_tsa[i]); i, ets->tc_tsa[i]);
return -ENOTSUPP; return -EOPNOTSUPP;
} }
} }
......
...@@ -2485,12 +2485,8 @@ static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac) ...@@ -2485,12 +2485,8 @@ static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac)
{ {
struct mlx4_en_priv *en_priv = netdev_priv(dev); struct mlx4_en_priv *en_priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = en_priv->mdev; struct mlx4_en_dev *mdev = en_priv->mdev;
u64 mac_u64 = mlx4_mac_to_u64(mac);
if (is_multicast_ether_addr(mac)) return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac);
return -EINVAL;
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,
......
...@@ -604,10 +604,10 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, ...@@ -604,10 +604,10 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
dma_sync_single_for_cpu(priv->ddev, dma, frag_info->frag_size, dma_sync_single_for_cpu(priv->ddev, dma, frag_info->frag_size,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
/* Save page reference in skb */ __skb_fill_page_desc(skb, nr, frags[nr].page,
__skb_frag_set_page(&skb_frags_rx[nr], frags[nr].page); frags[nr].page_offset,
skb_frag_size_set(&skb_frags_rx[nr], frag_info->frag_size); frag_info->frag_size);
skb_frags_rx[nr].page_offset = frags[nr].page_offset;
skb->truesize += frag_info->frag_stride; skb->truesize += frag_info->frag_stride;
frags[nr].page = NULL; frags[nr].page = NULL;
} }
......
...@@ -1249,8 +1249,7 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) ...@@ -1249,8 +1249,7 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
mlx4_warn(dev, "Failed adding irq rmap\n"); mlx4_warn(dev, "Failed adding irq rmap\n");
} }
#endif #endif
err = mlx4_create_eq(dev, dev->caps.num_cqs - err = mlx4_create_eq(dev, dev->quotas.cq +
dev->caps.reserved_cqs +
MLX4_NUM_SPARE_EQE, MLX4_NUM_SPARE_EQE,
(dev->flags & MLX4_FLAG_MSI_X) ? (dev->flags & MLX4_FLAG_MSI_X) ?
i + 1 - !!(i > MLX4_EQ_ASYNC) : 0, i + 1 - !!(i > MLX4_EQ_ASYNC) : 0,
......
...@@ -2436,7 +2436,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev, ...@@ -2436,7 +2436,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
#define CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET 4 #define CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET 4
if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV)) if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
return -ENOTSUPP; return -EOPNOTSUPP;
err = mlx4_CONFIG_DEV_get(dev, &config_dev); err = mlx4_CONFIG_DEV_get(dev, &config_dev);
if (err) if (err)
......
...@@ -136,7 +136,7 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable) ...@@ -136,7 +136,7 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable)
LIST_HEAD(bond_list); LIST_HEAD(bond_list);
if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP)) if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP))
return -ENOTSUPP; return -EOPNOTSUPP;
ret = mlx4_disable_rx_port_check(dev, enable); ret = mlx4_disable_rx_port_check(dev, enable);
if (ret) { if (ret) {
......
...@@ -841,8 +841,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) ...@@ -841,8 +841,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
return -EINVAL; return -EINVAL;
} }
mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz;
dev->caps.hca_core_clock = hca_param.hca_core_clock; dev->caps.hca_core_clock = hca_param.hca_core_clock;
memset(&dev_cap, 0, sizeof(dev_cap)); memset(&dev_cap, 0, sizeof(dev_cap));
...@@ -1447,7 +1445,7 @@ int mlx4_port_map_set(struct mlx4_dev *dev, struct mlx4_port_map *v2p) ...@@ -1447,7 +1445,7 @@ int mlx4_port_map_set(struct mlx4_dev *dev, struct mlx4_port_map *v2p)
int err; int err;
if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP)) if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP))
return -ENOTSUPP; return -EOPNOTSUPP;
mutex_lock(&priv->bond_mutex); mutex_lock(&priv->bond_mutex);
...@@ -1884,7 +1882,7 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, ...@@ -1884,7 +1882,7 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev,
struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_priv *priv = mlx4_priv(dev);
if (mlx4_is_slave(dev)) if (mlx4_is_slave(dev))
return -ENOTSUPP; return -EOPNOTSUPP;
if (!params) if (!params)
return -EINVAL; return -EINVAL;
...@@ -2384,7 +2382,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) ...@@ -2384,7 +2382,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
/* Query CONFIG_DEV parameters */ /* Query CONFIG_DEV parameters */
err = mlx4_config_dev_retrieval(dev, &params); err = mlx4_config_dev_retrieval(dev, &params);
if (err && err != -ENOTSUPP) { if (err && err != -EOPNOTSUPP) {
mlx4_err(dev, "Failed to query CONFIG_DEV parameters\n"); mlx4_err(dev, "Failed to query CONFIG_DEV parameters\n");
} else if (!err) { } else if (!err) {
dev->caps.rx_checksum_flags_port[1] = params.rx_csum_flags_port_1; dev->caps.rx_checksum_flags_port[1] = params.rx_csum_flags_port_1;
...@@ -3503,6 +3501,8 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, ...@@ -3503,6 +3501,8 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
goto err_disable_msix; goto err_disable_msix;
} }
mlx4_init_quotas(dev);
err = mlx4_setup_hca(dev); err = mlx4_setup_hca(dev);
if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
!mlx4_is_mfunc(dev)) { !mlx4_is_mfunc(dev)) {
...@@ -3515,7 +3515,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, ...@@ -3515,7 +3515,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
if (err) if (err)
goto err_steer; goto err_steer;
mlx4_init_quotas(dev);
/* When PF resources are ready arm its comm channel to enable /* When PF resources are ready arm its comm channel to enable
* getting commands * getting commands
*/ */
......
...@@ -823,7 +823,7 @@ int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type, ...@@ -823,7 +823,7 @@ int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type,
!(dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW)) || !(dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW)) ||
(type == MLX4_MW_TYPE_2 && (type == MLX4_MW_TYPE_2 &&
!(dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN))) !(dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN)))
return -ENOTSUPP; return -EOPNOTSUPP;
index = mlx4_mpt_reserve(dev); index = mlx4_mpt_reserve(dev);
if (index == -1) if (index == -1)
......
...@@ -447,7 +447,7 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, ...@@ -447,7 +447,7 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
& MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) { & MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) {
mlx4_warn(dev, mlx4_warn(dev,
"Trying to set src check LB, but it isn't supported\n"); "Trying to set src check LB, but it isn't supported\n");
err = -ENOTSUPP; err = -EOPNOTSUPP;
goto out; goto out;
} }
pri_addr_path_mask |= pri_addr_path_mask |=
......
...@@ -4297,7 +4297,7 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, ...@@ -4297,7 +4297,7 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave,
MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) { MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) {
mlx4_warn(dev, "Src check LB for slave %d isn't supported\n", mlx4_warn(dev, "Src check LB for slave %d isn't supported\n",
slave); slave);
return -ENOTSUPP; return -EOPNOTSUPP;
} }
/* Just change the smac for the QP */ /* Just change the smac for the QP */
......
...@@ -308,7 +308,7 @@ int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index, ...@@ -308,7 +308,7 @@ int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index,
int mlx4_get_vf_stats(struct mlx4_dev *dev, int port, int vf_idx, int mlx4_get_vf_stats(struct mlx4_dev *dev, int port, int vf_idx,
struct ifla_vf_stats *vf_stats); struct ifla_vf_stats *vf_stats);
u32 mlx4_comm_get_version(void); 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_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac);
int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan,
u8 qos, __be16 proto); u8 qos, __be16 proto);
int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate, int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
......
...@@ -104,4 +104,14 @@ static inline u64 mlx4_mac_to_u64(u8 *addr) ...@@ -104,4 +104,14 @@ static inline u64 mlx4_mac_to_u64(u8 *addr)
return mac; return mac;
} }
static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
{
int i;
for (i = ETH_ALEN; i > 0; i--) {
addr[i - 1] = mac && 0xFF;
mac >>= 8;
}
}
#endif /* MLX4_DRIVER_H */ #endif /* MLX4_DRIVER_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment