drivers/net/ethernet/mellanox/mlx5/core/Makefile | 7 +-
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 32 ++
drivers/net/ethernet/mellanox/mlx5/core/en.h | 18 ++
- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 354 +++++++++++++++++++++
+ .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 356 +++++++++++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 145 ++++++++-
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 25 ++
- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +
+ drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 10 +
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 6 +
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 47 +++
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 6 +
drivers/net/ethernet/mellanox/mlx5/core/sriov.c | 8 +
include/linux/mlx5/driver.h | 5 +
include/linux/mlx5/port.h | 5 +
- 21 files changed, 778 insertions(+), 3 deletions(-)
+ 21 files changed, 786 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/gsi.c b/drivers/infiniband/hw/mlx5/gsi.c
index xxxxxxx..xxxxxxx xxxxxx
struct ptys2ethtool_config {
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertised);
-@@ -126,6 +127,124 @@ void mlx5e_build_ptys2ethtool_map(void)
+@@ -103,8 +104,10 @@ void mlx5e_build_ptys2ethtool_map(void)
+ ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT);
+ MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_40GBASE_LR4, SPEED_40000,
+ ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT);
++#ifdef HAVE_ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT
+ MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_50GBASE_SR2, SPEED_50000,
+ ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT);
++#endif
+ MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100GBASE_CR4, SPEED_100000,
+ ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT);
+ MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100GBASE_SR4, SPEED_100000,
+@@ -126,6 +129,124 @@ void mlx5e_build_ptys2ethtool_map(void)
MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_50GBASE_KR2, SPEED_50000,
ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT);
}
static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv)
{
-@@ -258,13 +377,17 @@ static void mlx5e_get_strings(struct net_device *dev,
+@@ -258,13 +379,17 @@ static void mlx5e_get_strings(struct net_device *dev,
uint32_t stringset, uint8_t *data)
{
struct mlx5e_priv *priv = netdev_priv(dev);
case ETH_SS_TEST:
break;
-@@ -505,6 +628,7 @@ static int mlx5e_set_ringparam(struct net_device *dev,
+@@ -505,6 +630,7 @@ static int mlx5e_set_ringparam(struct net_device *dev,
return err;
}
static void mlx5e_get_channels(struct net_device *dev,
struct ethtool_channels *ch)
{
-@@ -583,6 +707,7 @@ out:
+@@ -583,6 +709,7 @@ out:
return err;
}
static int mlx5e_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coal)
-@@ -656,6 +781,7 @@ out:
+@@ -656,6 +783,7 @@ out:
return err;
}
static void ptys2ethtool_supported_link(unsigned long *supported_modes,
u32 eth_proto_cap)
{
-@@ -700,6 +826,52 @@ static void ptys2ethtool_supported_port(struct ethtool_link_ksettings *link_kset
+@@ -700,6 +828,52 @@ static void ptys2ethtool_supported_port(struct ethtool_link_ksettings *link_kset
ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Backplane);
}
}
int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed)
{
-@@ -722,7 +894,11 @@ int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed)
+@@ -722,7 +896,11 @@ int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed)
static void get_speed_duplex(struct net_device *netdev,
u32 eth_proto_oper,
{
int i;
u32 speed = SPEED_UNKNOWN;
-@@ -739,10 +915,16 @@ static void get_speed_duplex(struct net_device *netdev,
+@@ -739,10 +917,16 @@ static void get_speed_duplex(struct net_device *netdev,
}
}
out:
static void get_supported(u32 eth_proto_cap,
struct ethtool_link_ksettings *link_ksettings)
{
-@@ -799,7 +981,54 @@ static void get_lp_advertising(u32 eth_proto_lp,
+@@ -799,7 +983,54 @@ static void get_lp_advertising(u32 eth_proto_lp,
ptys2ethtool_adver_link(lp_advertising, eth_proto_lp);
}
static int mlx5e_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *link_ksettings)
{
-@@ -942,6 +1171,122 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
+@@ -942,6 +1173,122 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
out:
return err;
}
static u32 mlx5e_get_rxfh_key_size(struct net_device *netdev)
{
-@@ -1056,6 +1401,7 @@ static int mlx5e_get_rxnfc(struct net_device *netdev,
+@@ -1056,6 +1403,7 @@ static int mlx5e_get_rxnfc(struct net_device *netdev,
return err;
}
static int mlx5e_get_tunable(struct net_device *dev,
const struct ethtool_tunable *tuna,
void *data)
-@@ -1113,6 +1459,7 @@ static int mlx5e_set_tunable(struct net_device *dev,
+@@ -1113,6 +1461,7 @@ static int mlx5e_set_tunable(struct net_device *dev,
return err;
}
static void mlx5e_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pauseparam)
-@@ -1517,16 +1864,23 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
+@@ -1517,16 +1866,23 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
.set_channels = mlx5e_set_channels,
.get_coalesce = mlx5e_get_coalesce,
.set_coalesce = mlx5e_set_coalesce,
return 0;
}
-+#ifdef HAVE_NDO_SETUP_TC
++#ifdef HAVE_TC_OFFLOAD
static int set_feature_tc_num_filters(struct net_device *netdev, bool enable)
{
struct mlx5e_priv *priv = netdev_priv(netdev);
index xxxxxxx..xxxxxxx xxxxxx
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
-@@ -30,6 +30,7 @@
+@@ -30,14 +30,19 @@
* SOFTWARE.
*/
+#ifdef HAVE_TC_OFFLOAD
++#ifdef HAVE_NET_FLOW_DISSECTOR_H
#include <net/flow_dissector.h>
++#endif
#include <net/pkt_cls.h>
#include <net/tc_act/tc_gact.h>
-@@ -145,6 +146,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
+ #include <net/tc_act/tc_skbedit.h>
+ #include <linux/mlx5/fs.h>
+ #include <linux/mlx5/device.h>
+ #include <linux/rhashtable.h>
++#ifdef HAVE_NET_SWITCHDEV_H
+ #include <net/switchdev.h>
++#endif
+ #include <net/tc_act/tc_mirred.h>
+ #include "en.h"
+ #include "en_tc.h"
+@@ -52,6 +57,7 @@ struct mlx5e_tc_flow {
+ #define MLX5E_TC_TABLE_NUM_ENTRIES 1024
+ #define MLX5E_TC_TABLE_NUM_GROUPS 4
+
++#ifdef HAVE_HW_FLOWER_OFFLOAD_SUPPORT
+ static struct mlx5_flow_rule *mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
+ struct mlx5_flow_spec *spec,
+ u32 action, u32 flow_tag)
+@@ -127,6 +133,7 @@ static struct mlx5_flow_rule *mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
+
+ return mlx5_eswitch_add_offloaded_rule(esw, spec, action, src_vport, dst_vport);
+ }
++#endif
+
+ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
+ struct mlx5_flow_rule *rule)
+@@ -145,6 +152,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
}
}
static int parse_cls_flower(struct mlx5e_priv *priv, struct mlx5_flow_spec *spec,
struct tc_cls_flower_offload *f)
{
-@@ -529,6 +531,7 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
+@@ -529,6 +537,7 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv,
return 0;
}
static const struct rhashtable_params mlx5e_tc_flow_ht_params = {
.head_offset = offsetof(struct mlx5e_tc_flow, node),
-@@ -565,3 +568,4 @@ void mlx5e_tc_cleanup(struct mlx5e_priv *priv)
+@@ -565,3 +574,4 @@ void mlx5e_tc_cleanup(struct mlx5e_priv *priv)
tc->t = NULL;
}
}