History

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: eee2faabc63d tcp: account for ts offset only if tsecr not zero v3: * Rebased, conflict solved. v2: * Added Eric's fix (patch 5/5). ====================

David S. Miller committed 9 years ago

Commit e65ade72 parents c12f4d7 7f0137e13 files · +49 −27Browse files

Unified · Split

13 files
  1. drivers/net/ethernet/mellanox/mlx4/cmd.c +20 −2
  2. drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +1 −1
  3. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 −5
  4. drivers/net/ethernet/mellanox/mlx4/en_rx.c +4 −4
  5. drivers/net/ethernet/mellanox/mlx4/eq.c +2 −3
  6. drivers/net/ethernet/mellanox/mlx4/fw.c +1 −1
  7. drivers/net/ethernet/mellanox/mlx4/intf.c +1 −1
  8. drivers/net/ethernet/mellanox/mlx4/main.c +5 −6
  9. drivers/net/ethernet/mellanox/mlx4/mr.c +1 −1
  10. drivers/net/ethernet/mellanox/mlx4/qp.c +1 −1
  11. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 −1
  12. include/linux/mlx4/cmd.h +1 −1
  13. include/linux/mlx4/driver.h +10 −0
drivers/net/ethernet/mellanox/mlx4/cmd.c+20−2
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 #include <linux/semaphore.h>
4444 #include <rdma/ib_smi.h>
4545 #include <linux/delay.h>
46+#include <linux/etherdevice.h>
4647
4748 #include <asm/io.h>
4849
@@ -2955,7 +2956,7 @@ static bool mlx4_valid_vf_state_change(struct mlx4_dev *dev, int port, · 2906 unmodified lines
29552956 return false;
29562957 }
29572958
2958−int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
2959+int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac)
29592960 {
29602961 struct mlx4_priv *priv = mlx4_priv(dev);
29612962 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) · 2 unmodified lines
29642965 if (!mlx4_is_master(dev))
29652966 return -EPROTONOSUPPORT;
29662967
2968+ if (is_multicast_ether_addr(mac))
2969+ return -EINVAL;
2970+
29672971 slave = mlx4_get_slave_indx(dev, vf);
29682972 if (slave < 0)
29692973 return -EINVAL;
29702974
29712975 port = mlx4_slaves_closest_port(dev, slave, port);
29722976 s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
2973− s_info->mac = mac;
2977+
2978+ if (s_info->spoofchk && is_zero_ether_addr(mac)) {
2979+ mlx4_info(dev, "MAC invalidation is not allowed when spoofchk is on\n");
2980+ return -EPERM;
2981+ }
2982+
2983+ s_info->mac = mlx4_mac_to_u64(mac);
29742984 mlx4_info(dev, "default mac on vf %d port %d to %llX will take effect only after vf restart\n",
29752985 vf, port, s_info->mac);
29762986 return 0;
@@ -3143,6 +3153,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) · 166 unmodified lines
31433153 struct mlx4_priv *priv = mlx4_priv(dev);
31443154 struct mlx4_vport_state *s_info;
31453155 int slave;
3156+ u8 mac[ETH_ALEN];
31463157
31473158 if ((!mlx4_is_master(dev)) ||
31483159 !(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) · 5 unmodified lines
31543165
31553166 port = mlx4_slaves_closest_port(dev, slave, port);
31563167 s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
3168+
3169+ mlx4_u64_to_mac(mac, s_info->mac);
3170+ if (setting && !is_valid_ether_addr(mac)) {
3171+ mlx4_info(dev, "Illegal MAC with spoofchk\n");
3172+ return -EPERM;
3173+ }
3174+
31573175 s_info->spoofchk = setting;
31583176
31593177 return 0;
drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c+1−1
@@ -319,7 +319,7 @@ static int mlx4_en_ets_validate(struct mlx4_en_priv *priv, struct ieee_ets *ets) · 318 unmodified lines
319319 default:
320320 en_err(priv, "TC[%d]: Not supported TSA: %d\n",
321321 i, ets->tc_tsa[i]);
322− return -ENOTSUPP;
322+ return -EOPNOTSUPP;
323323 }
324324 }
325325
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+1−5
@@ -2485,12 +2485,8 @@ static int mlx4_en_set_vf_mac(struct net_device *dev, int queue, u8 *mac) · 2484 unmodified lines
24852485 {
24862486 struct mlx4_en_priv *en_priv = netdev_priv(dev);
24872487 struct mlx4_en_dev *mdev = en_priv->mdev;
2488− u64 mac_u64 = mlx4_mac_to_u64(mac);
24892488
2490− if (is_multicast_ether_addr(mac))
2491− return -EINVAL;
2492−
2493− return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac_u64);
2489+ return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac);
24942490 }
24952491
24962492 static int mlx4_en_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos,
drivers/net/ethernet/mellanox/mlx4/en_rx.c+4−4
@@ -604,10 +604,10 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, · 603 unmodified lines
604604 dma_sync_single_for_cpu(priv->ddev, dma, frag_info->frag_size,
605605 DMA_FROM_DEVICE);
606606
607− /* Save page reference in skb */
608− __skb_frag_set_page(&skb_frags_rx[nr], frags[nr].page);
609− skb_frag_size_set(&skb_frags_rx[nr], frag_info->frag_size);
610− skb_frags_rx[nr].page_offset = frags[nr].page_offset;
607+ __skb_fill_page_desc(skb, nr, frags[nr].page,
608+ frags[nr].page_offset,
609+ frag_info->frag_size);
610+
611611 skb->truesize += frag_info->frag_stride;
612612 frags[nr].page = NULL;
613613 }
drivers/net/ethernet/mellanox/mlx4/eq.c+2−3
@@ -1249,9 +1249,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) · 1248 unmodified lines
12491249 mlx4_warn(dev, "Failed adding irq rmap\n");
12501250 }
12511251 #endif
1252− err = mlx4_create_eq(dev, dev->caps.num_cqs -
1253− dev->caps.reserved_cqs +
1254− MLX4_NUM_SPARE_EQE,
1252+ err = mlx4_create_eq(dev, dev->quotas.cq +
1253+ MLX4_NUM_SPARE_EQE,
12551254 (dev->flags & MLX4_FLAG_MSI_X) ?
12561255 i + 1 - !!(i > MLX4_EQ_ASYNC) : 0,
12571256 eq);
drivers/net/ethernet/mellanox/mlx4/fw.c+1−1
@@ -2436,7 +2436,7 @@ int mlx4_config_dev_retrieval(struct mlx4_dev *dev, · 2435 unmodified lines
24362436 #define CONFIG_DEV_RX_CSUM_MODE_PORT2_BIT_OFFSET 4
24372437
24382438 if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_CONFIG_DEV))
2439− return -ENOTSUPP;
2439+ return -EOPNOTSUPP;
24402440
24412441 err = mlx4_CONFIG_DEV_get(dev, &config_dev);
24422442 if (err)
drivers/net/ethernet/mellanox/mlx4/intf.c+1−1
@@ -136,7 +136,7 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable) · 135 unmodified lines
136136 LIST_HEAD(bond_list);
137137
138138 if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP))
139− return -ENOTSUPP;
139+ return -EOPNOTSUPP;
140140
141141 ret = mlx4_disable_rx_port_check(dev, enable);
142142 if (ret) {
drivers/net/ethernet/mellanox/mlx4/main.c+5−6
@@ -841,8 +841,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) · 840 unmodified lines
841841 return -EINVAL;
842842 }
843843
844− mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz;
845−
846844 dev->caps.hca_core_clock = hca_param.hca_core_clock;
847845
848846 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) · 598 unmodified lines
14471445 int err;
14481446
14491447 if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_REMAP))
1450− return -ENOTSUPP;
1448+ return -EOPNOTSUPP;
14511449
14521450 mutex_lock(&priv->bond_mutex);
14531451
@@ -1884,7 +1882,7 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, · 430 unmodified lines
18841882 struct mlx4_priv *priv = mlx4_priv(dev);
18851883
18861884 if (mlx4_is_slave(dev))
1887− return -ENOTSUPP;
1885+ return -EOPNOTSUPP;
18881886
18891887 if (!params)
18901888 return -EINVAL;
@@ -2384,7 +2382,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) · 493 unmodified lines
23842382
23852383 /* Query CONFIG_DEV parameters */
23862384 err = mlx4_config_dev_retrieval(dev, &params);
2387− if (err && err != -ENOTSUPP) {
2385+ if (err && err != -EOPNOTSUPP) {
23882386 mlx4_err(dev, "Failed to query CONFIG_DEV parameters\n");
23892387 } else if (!err) {
23902388 dev->caps.rx_checksum_flags_port[1] = params.rx_csum_flags_port_1;
@@ -3503,6 +3501,8 @@ slave_start: · 1112 unmodified lines
35033501 goto err_disable_msix;
35043502 }
35053503
3504+ mlx4_init_quotas(dev);
3505+
35063506 err = mlx4_setup_hca(dev);
35073507 if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
35083508 !mlx4_is_mfunc(dev)) {
@@ -3515,7 +3515,6 @@ slave_start: · 6 unmodified lines
35153515 if (err)
35163516 goto err_steer;
35173517
3518− mlx4_init_quotas(dev);
35193518 /* When PF resources are ready arm its comm channel to enable
35203519 * getting commands
35213520 */
drivers/net/ethernet/mellanox/mlx4/mr.c+1−1
@@ -823,7 +823,7 @@ int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type, · 822 unmodified lines
823823 !(dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW)) ||
824824 (type == MLX4_MW_TYPE_2 &&
825825 !(dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN)))
826− return -ENOTSUPP;
826+ return -EOPNOTSUPP;
827827
828828 index = mlx4_mpt_reserve(dev);
829829 if (index == -1)
drivers/net/ethernet/mellanox/mlx4/qp.c+1−1
@@ -447,7 +447,7 @@ int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, · 446 unmodified lines
447447 & MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) {
448448 mlx4_warn(dev,
449449 "Trying to set src check LB, but it isn't supported\n");
450− err = -ENOTSUPP;
450+ err = -EOPNOTSUPP;
451451 goto out;
452452 }
453453 pri_addr_path_mask |=
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c+1−1
@@ -4297,7 +4297,7 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, · 4296 unmodified lines
42974297 MLX4_DEV_CAP_FLAG2_UPDATE_QP_SRC_CHECK_LB)) {
42984298 mlx4_warn(dev, "Src check LB for slave %d isn't supported\n",
42994299 slave);
4300− return -ENOTSUPP;
4300+ return -EOPNOTSUPP;
43014301 }
43024302
43034303 /* Just change the smac for the QP */
include/linux/mlx4/cmd.h+1−1
@@ -308,7 +308,7 @@ int mlx4_get_counter_stats(struct mlx4_dev *dev, int counter_index, · 307 unmodified lines
308308 int mlx4_get_vf_stats(struct mlx4_dev *dev, int port, int vf_idx,
309309 struct ifla_vf_stats *vf_stats);
310310 u32 mlx4_comm_get_version(void);
311−int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
311+int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u8 *mac);
312312 int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan,
313313 u8 qos, __be16 proto);
314314 int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
include/linux/mlx4/driver.h+10−0
@@ -104,4 +104,14 @@ static inline u64 mlx4_mac_to_u64(u8 *addr) · 103 unmodified lines
104104 return mac;
105105 }
106106
107+static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
108+{
109+ int i;
110+
111+ for (i = ETH_ALEN; i > 0; i--) {
112+ addr[i - 1] = mac && 0xFF;
113+ mac >>= 8;
114+ }
115+}
116+
107117 #endif /* MLX4_DRIVER_H */