From: Vladimir Sokolovsky Date: Thu, 28 Jan 2016 14:17:43 +0000 (+0200) Subject: mlx4: Added support for RHEL7.2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d4a9e382813608ce74c2d345d3de1646e1f4dd85;p=~emulex%2Ftmp%2Fcompat-rdma%2F.git mlx4: Added support for RHEL7.2 Signed-off-by: Vladimir Sokolovsky --- diff --git a/patches/0003-BACKPORT-mlx4.patch b/patches/0003-BACKPORT-mlx4.patch index c9adcc8..2c1f836 100644 --- a/patches/0003-BACKPORT-mlx4.patch +++ b/patches/0003-BACKPORT-mlx4.patch @@ -6,10 +6,10 @@ Signed-off-by: Vladimir Sokolovsky drivers/infiniband/hw/mlx4/cm.c | 27 ++++ drivers/infiniband/hw/mlx4/main.c | 8 + drivers/net/ethernet/mellanox/mlx4/cmd.c | 6 + - drivers/net/ethernet/mellanox/mlx4/en_clock.c | 2 + + drivers/net/ethernet/mellanox/mlx4/en_clock.c | 10 ++ drivers/net/ethernet/mellanox/mlx4/en_cq.c | 11 ++ drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | 4 + - drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 62 ++++++- + drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 87 +++++++++- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 206 ++++++++++++++++++++++++ drivers/net/ethernet/mellanox/mlx4/en_rx.c | 84 +++++++++- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 53 +++++- @@ -17,7 +17,8 @@ Signed-off-by: Vladimir Sokolovsky drivers/net/ethernet/mellanox/mlx4/main.c | 24 +++ drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 21 ++- include/linux/mlx4/cq.h | 5 + - 14 files changed, 518 insertions(+), 5 deletions(-) + include/linux/mlx4/device.h | 4 + + 15 files changed, 553 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index xxxxxxx..xxxxxxx xxxxxx @@ -136,6 +137,30 @@ index xxxxxxx..xxxxxxx xxxxxx .pps = 0, .adjfreq = mlx4_en_phc_adjfreq, .adjtime = mlx4_en_phc_adjtime, +@@ -289,7 +291,11 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) + { + struct mlx4_dev *dev = mdev->dev; + unsigned long flags; ++#ifdef HAVE_CYCLECOUNTER_CYC2NS_4_PARAMS ++ u64 ns, zero = 0; ++#else + u64 ns; ++#endif + + rwlock_init(&mdev->clock_lock); + +@@ -314,7 +320,11 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) + /* Calculate period in seconds to call the overflow watchdog - to make + * sure counter is checked at least once every wrap around. + */ ++#ifdef HAVE_CYCLECOUNTER_CYC2NS_4_PARAMS ++ ns = cyclecounter_cyc2ns(&mdev->cycles, mdev->cycles.mask, zero, &zero); ++#else + ns = cyclecounter_cyc2ns(&mdev->cycles, mdev->cycles.mask); ++#endif + do_div(ns, NSEC_PER_SEC / 2 / HZ); + mdev->overflow_period = ns; + diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c @@ -228,49 +253,56 @@ diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ether index xxxxxxx..xxxxxxx xxxxxx --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c -@@ -580,6 +580,7 @@ static void mlx4_en_get_ringparam(struct net_device *dev, +@@ -580,14 +580,27 @@ static void mlx4_en_get_ringparam(struct net_device *dev, param->tx_pending = priv->tx_ring[0]->size; } -+#if defined(HAVE_GET_SET_RXFH) || defined(HAVE_GET_SET_RXFH_INDIR) - static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) +-static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) ++#if defined(HAVE_RXFH_INDIR_SIZE) || defined(HAVE_RXFH_INDIR_SIZE_EXT) ++u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); -@@ -587,7 +588,11 @@ static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) + return priv->rx_ring_num; } ++#endif -+#ifdef HAVE_GET_SET_RXFH_INDIR -+static int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index) +-static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key) ++#if defined(HAVE_GET_SET_RXFH) && !defined(HAVE_GET_SET_RXFH_INDIR_EXT) ++static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, ++#ifdef HAVE_ETH_SS_RSS_HASH_FUNCS ++ u8 *key, u8 *hfunc) +#else - static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key) ++ u8 *key) ++#endif ++#elif defined(HAVE_GET_SET_RXFH_INDIR) || defined (HAVE_GET_SET_RXFH_INDIR_EXT) ++static int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index) ++#elif defined(CONFIG_SYSFS_INDIR_SETTING) ++int mlx4_en_get_rxfh_indir(struct net_device *dev, u32 *ring_index) +#endif { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_rss_map *rss_map = &priv->rss_map; -@@ -605,8 +610,13 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key) +@@ -605,8 +618,18 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key) return err; } -+#ifdef HAVE_GET_SET_RXFH_INDIR -+static int mlx4_en_set_rxfh_indir(struct net_device *dev, -+ const u32 *ring_index) -+#else ++#if defined(HAVE_GET_SET_RXFH) && !defined(HAVE_GET_SET_RXFH_INDIR_EXT) static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, ++#ifdef HAVE_ETH_SS_RSS_HASH_FUNCS ++ const u8 *key, const u8 hfunc) ++#else const u8 *key) ++#endif ++#elif defined(HAVE_GET_SET_RXFH_INDIR) || defined (HAVE_GET_SET_RXFH_INDIR_EXT) ++static int mlx4_en_set_rxfh_indir(struct net_device *dev, const u32 *ring_index) ++#elif defined(CONFIG_SYSFS_INDIR_SETTING) ++int mlx4_en_set_rxfh_indir(struct net_device *dev, const u32 *ring_index) +#endif { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; -@@ -650,6 +660,7 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, - mutex_unlock(&mdev->state_lock); - return err; - } -+#endif - - #define all_zeros_or_all_ones(field) \ - ((field) == 0 || (field) == (__force typeof(field))-1) -@@ -664,11 +675,13 @@ static int mlx4_en_validate_flow(struct net_device *dev, +@@ -664,11 +687,13 @@ static int mlx4_en_validate_flow(struct net_device *dev, if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) return -EINVAL; @@ -284,7 +316,7 @@ index xxxxxxx..xxxxxxx xxxxxx switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { case TCP_V4_FLOW: -@@ -760,9 +773,11 @@ static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, +@@ -760,9 +785,11 @@ static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, unsigned char mac[ETH_ALEN]; if (!ipv4_is_multicast(ipv4_dst)) { @@ -296,7 +328,7 @@ index xxxxxxx..xxxxxxx xxxxxx memcpy(&mac, priv->dev->dev_addr, ETH_ALEN); } else { ip_eth_mc_map(ipv4_dst, mac); -@@ -1058,8 +1073,13 @@ static int mlx4_en_get_num_flows(struct mlx4_en_priv *priv) +@@ -1058,8 +1085,13 @@ static int mlx4_en_get_num_flows(struct mlx4_en_priv *priv) } @@ -310,11 +342,11 @@ index xxxxxxx..xxxxxxx xxxxxx { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; -@@ -1087,7 +1107,11 @@ static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, +@@ -1087,7 +1119,11 @@ static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) { err = mlx4_en_get_flow(dev, cmd, i); if (!err) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) ++#ifdef HAVE_ETHTOOL_OPS_GET_RXNFC_U32_RULE_LOCS rule_locs[priority++] = i; +#else + ((u32 *)(rule_locs))[priority++] = i; @@ -322,7 +354,7 @@ index xxxxxxx..xxxxxxx xxxxxx i++; } err = 0; -@@ -1125,6 +1149,7 @@ static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) +@@ -1125,6 +1161,7 @@ static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) return err; } @@ -330,21 +362,26 @@ index xxxxxxx..xxxxxxx xxxxxx static void mlx4_en_get_channels(struct net_device *dev, struct ethtool_channels *channel) { -@@ -1174,8 +1199,12 @@ static int mlx4_en_set_channels(struct net_device *dev, +@@ -1171,11 +1208,17 @@ static int mlx4_en_set_channels(struct net_device *dev, + goto out; + } + ++#ifdef HAVE_NEW_TX_RING_SCHEME netif_set_real_num_tx_queues(dev, priv->tx_ring_num); ++#else ++ dev->real_num_tx_queues = priv->tx_ring_num; ++#endif netif_set_real_num_rx_queues(dev, priv->rx_ring_num); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) - if (dev->num_tc) -- mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP); -+#else +- if (dev->num_tc) ++#ifdef HAVE_NEW_TX_RING_SCHEME + if (netdev_get_num_tc(dev)) + mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP); +#endif -+ mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP); en_warn(priv, "Using %d TX rings\n", priv->tx_ring_num); en_warn(priv, "Using %d RX rings\n", priv->rx_ring_num); -@@ -1192,7 +1221,9 @@ out: +@@ -1192,7 +1235,9 @@ out: mutex_unlock(&mdev->state_lock); return err; } @@ -354,7 +391,7 @@ index xxxxxxx..xxxxxxx xxxxxx static int mlx4_en_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { -@@ -1224,6 +1255,7 @@ static int mlx4_en_get_ts_info(struct net_device *dev, +@@ -1224,6 +1269,7 @@ static int mlx4_en_get_ts_info(struct net_device *dev, return ret; } @@ -362,7 +399,7 @@ index xxxxxxx..xxxxxxx xxxxxx static int mlx4_en_set_priv_flags(struct net_device *dev, u32 flags) { -@@ -1267,6 +1299,7 @@ static u32 mlx4_en_get_priv_flags(struct net_device *dev) +@@ -1267,6 +1313,7 @@ static u32 mlx4_en_get_priv_flags(struct net_device *dev) return priv->pflags; } @@ -370,7 +407,7 @@ index xxxxxxx..xxxxxxx xxxxxx static int mlx4_en_get_tunable(struct net_device *dev, const struct ethtool_tunable *tuna, void *data) -@@ -1308,7 +1341,7 @@ static int mlx4_en_set_tunable(struct net_device *dev, +@@ -1308,7 +1355,7 @@ static int mlx4_en_set_tunable(struct net_device *dev, return ret; } @@ -379,14 +416,19 @@ index xxxxxxx..xxxxxxx xxxxxx const struct ethtool_ops mlx4_en_ethtool_ops = { .get_drvinfo = mlx4_en_get_drvinfo, -@@ -1331,18 +1364,43 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { +@@ -1331,18 +1378,50 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { .set_ringparam = mlx4_en_set_ringparam, .get_rxnfc = mlx4_en_get_rxnfc, .set_rxnfc = mlx4_en_set_rxnfc, -+#if defined(HAVE_GET_SET_RXFH) && !defined(HAVE_GET_SET_RXFH_INDIR) ++#if defined(HAVE_RXFH_INDIR_SIZE) && !defined(HAVE_RXFH_INDIR_SIZE_EXT) .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size, ++#endif ++#if defined(HAVE_GET_SET_RXFH) && !defined(HAVE_GET_SET_RXFH_INDIR_EXT) .get_rxfh = mlx4_en_get_rxfh, .set_rxfh = mlx4_en_set_rxfh, ++#elif defined(HAVE_GET_SET_RXFH_INDIR) && !defined(HAVE_GET_SET_RXFH_INDIR_EXT) ++ .get_rxfh_indir = mlx4_en_get_rxfh_indir, ++ .set_rxfh_indir = mlx4_en_set_rxfh_indir, +#endif +#ifdef HAVE_GET_SET_CHANNELS .get_channels = mlx4_en_get_channels, @@ -406,8 +448,10 @@ index xxxxxxx..xxxxxxx xxxxxx +#ifdef HAVE_ETHTOOL_OPS_EXT +const struct ethtool_ops_ext mlx4_en_ethtool_ops_ext = { + .size = sizeof(struct ethtool_ops_ext), ++#ifdef HAVE_RXFH_INDIR_SIZE_EXT + .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size, -+#ifdef HAVE_GET_SET_RXFH_INDIR ++#endif ++#ifdef HAVE_GET_SET_RXFH_INDIR_EXT + .get_rxfh_indir = mlx4_en_get_rxfh_indir, + .set_rxfh_indir = mlx4_en_set_rxfh_indir, +#endif @@ -1578,3 +1622,19 @@ index xxxxxxx..xxxxxxx xxxxxx #include #include +diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h +index xxxxxxx..xxxxxxx xxxxxx +--- a/include/linux/mlx4/device.h ++++ b/include/linux/mlx4/device.h +@@ -42,7 +42,11 @@ + + #include + ++#ifdef HAVE_TIMECOUNTER_H ++#include ++#else + #include ++#endif + + #define MAX_MSIX_P_PORT 17 + #define MAX_MSIX 64