Skip to content

Commit 3bd09b0

Browse files
committed
Merge tag 'mlx5e-updates-2018-10-01' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5e-updates-2018-10-01 This series includes updates to mlx5e ethernet netdevice driver: From Or Gerlitz: 1) Support masks for l3/l4 filters in ethtool flow steering 2) Report checksum unnecessary also when the L3 checksum flag on the cqe is set and there's no L4 header 3) Allow reporting of checksum unnecessary, using an ethtool private flag. From Gavi Teitz and Or, VF representors netdevs performance improvements 4) Allow striding RQ in VF representor and bigger RQ size, ~3X performance improvement 5) Enable stateless offloads for VF representor, csum and TSO, 1.5X performance improvement 6) RSS Support for VF representors 6.1) Allow flow table destination fir VF representor steering rule. 6.2) Create RSS flow table per representor netdev 6.3) Expose mlx5e RSS ethtool to be used by representor netdevs 6.4) Enable multi-queue and RSS for VF representors, using mlx5e existing infrastructure for managing a multi-queue RX RSS tables. From Alaa Hleihel: 7) Cache the system image guid, The system image guid is a read-only field Read this once and save it on the core device. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 041a14d + 59c9d35 commit 3bd09b0

File tree

13 files changed

+312
-104
lines changed

13 files changed

+312
-104
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ enum mlx5e_priv_flag {
209209
MLX5E_PFLAG_TX_CQE_BASED_MODER = (1 << 1),
210210
MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 2),
211211
MLX5E_PFLAG_RX_STRIDING_RQ = (1 << 3),
212+
MLX5E_PFLAG_RX_NO_CSUM_COMPLETE = (1 << 4),
212213
};
213214

214215
#define MLX5E_SET_PFLAG(params, pflag, enable) \
@@ -290,6 +291,7 @@ struct mlx5e_dcbx_dp {
290291
enum {
291292
MLX5E_RQ_STATE_ENABLED,
292293
MLX5E_RQ_STATE_AM,
294+
MLX5E_RQ_STATE_NO_CSUM_COMPLETE,
293295
};
294296

295297
struct mlx5e_cq {
@@ -906,8 +908,8 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq);
906908

907909
int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv);
908910

909-
int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv);
910-
void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv);
911+
int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
912+
void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
911913

912914
int mlx5e_create_direct_rqts(struct mlx5e_priv *priv);
913915
void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv);
@@ -951,6 +953,8 @@ int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
951953
struct ethtool_coalesce *coal);
952954
int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
953955
struct ethtool_coalesce *coal);
956+
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv);
957+
u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv);
954958
int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
955959
struct ethtool_ts_info *info);
956960
int mlx5e_ethtool_flash_device(struct mlx5e_priv *priv,
@@ -966,6 +970,9 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
966970
void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
967971
struct mlx5e_params *params,
968972
u16 max_channels, u16 mtu);
973+
void mlx5e_build_rq_params(struct mlx5_core_dev *mdev,
974+
struct mlx5e_params *params);
975+
void mlx5e_build_rss_params(struct mlx5e_params *params);
969976
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev);
970977
void mlx5e_rx_dim_work(struct work_struct *work);
971978
void mlx5e_tx_dim_work(struct work_struct *work);

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static const char mlx5e_priv_flags[][ETH_GSTRING_LEN] = {
140140
"tx_cqe_moder",
141141
"rx_cqe_compress",
142142
"rx_striding_rq",
143+
"rx_no_csum_complete",
143144
};
144145

145146
int mlx5e_ethtool_get_sset_count(struct mlx5e_priv *priv, int sset)
@@ -859,18 +860,30 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
859860
return err;
860861
}
861862

863+
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv)
864+
{
865+
return sizeof(priv->channels.params.toeplitz_hash_key);
866+
}
867+
862868
static u32 mlx5e_get_rxfh_key_size(struct net_device *netdev)
863869
{
864870
struct mlx5e_priv *priv = netdev_priv(netdev);
865871

866-
return sizeof(priv->channels.params.toeplitz_hash_key);
872+
return mlx5e_ethtool_get_rxfh_key_size(priv);
867873
}
868874

869-
static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)
875+
u32 mlx5e_ethtool_get_rxfh_indir_size(struct mlx5e_priv *priv)
870876
{
871877
return MLX5E_INDIR_RQT_SIZE;
872878
}
873879

880+
static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)
881+
{
882+
struct mlx5e_priv *priv = netdev_priv(netdev);
883+
884+
return mlx5e_ethtool_get_rxfh_indir_size(priv);
885+
}
886+
874887
static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
875888
u8 *hfunc)
876889
{
@@ -1519,6 +1532,27 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
15191532
return 0;
15201533
}
15211534

1535+
static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable)
1536+
{
1537+
struct mlx5e_priv *priv = netdev_priv(netdev);
1538+
struct mlx5e_channels *channels = &priv->channels;
1539+
struct mlx5e_channel *c;
1540+
int i;
1541+
1542+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
1543+
return 0;
1544+
1545+
for (i = 0; i < channels->num; i++) {
1546+
c = channels->c[i];
1547+
if (enable)
1548+
__set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
1549+
else
1550+
__clear_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
1551+
}
1552+
1553+
return 0;
1554+
}
1555+
15221556
static int mlx5e_handle_pflag(struct net_device *netdev,
15231557
u32 wanted_flags,
15241558
enum mlx5e_priv_flag flag,
@@ -1570,6 +1604,12 @@ static int mlx5e_set_priv_flags(struct net_device *netdev, u32 pflags)
15701604
err = mlx5e_handle_pflag(netdev, pflags,
15711605
MLX5E_PFLAG_RX_STRIDING_RQ,
15721606
set_pflag_rx_striding_rq);
1607+
if (err)
1608+
goto out;
1609+
1610+
err = mlx5e_handle_pflag(netdev, pflags,
1611+
MLX5E_PFLAG_RX_NO_CSUM_COMPLETE,
1612+
set_pflag_rx_no_csum_complete);
15731613

15741614
out:
15751615
mutex_unlock(&priv->state_lock);

drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ set_ip4(void *headers_c, void *headers_v, __be32 ip4src_m,
131131
if (ip4src_m) {
132132
memcpy(MLX5E_FTE_ADDR_OF(headers_v, src_ipv4_src_ipv6.ipv4_layout.ipv4),
133133
&ip4src_v, sizeof(ip4src_v));
134-
memset(MLX5E_FTE_ADDR_OF(headers_c, src_ipv4_src_ipv6.ipv4_layout.ipv4),
135-
0xff, sizeof(ip4src_m));
134+
memcpy(MLX5E_FTE_ADDR_OF(headers_c, src_ipv4_src_ipv6.ipv4_layout.ipv4),
135+
&ip4src_m, sizeof(ip4src_m));
136136
}
137137
if (ip4dst_m) {
138138
memcpy(MLX5E_FTE_ADDR_OF(headers_v, dst_ipv4_dst_ipv6.ipv4_layout.ipv4),
139139
&ip4dst_v, sizeof(ip4dst_v));
140-
memset(MLX5E_FTE_ADDR_OF(headers_c, dst_ipv4_dst_ipv6.ipv4_layout.ipv4),
141-
0xff, sizeof(ip4dst_m));
140+
memcpy(MLX5E_FTE_ADDR_OF(headers_c, dst_ipv4_dst_ipv6.ipv4_layout.ipv4),
141+
&ip4dst_m, sizeof(ip4dst_m));
142142
}
143143

144144
MLX5E_FTE_SET(headers_c, ethertype, 0xffff);
@@ -173,11 +173,11 @@ set_tcp(void *headers_c, void *headers_v, __be16 psrc_m, __be16 psrc_v,
173173
__be16 pdst_m, __be16 pdst_v)
174174
{
175175
if (psrc_m) {
176-
MLX5E_FTE_SET(headers_c, tcp_sport, 0xffff);
176+
MLX5E_FTE_SET(headers_c, tcp_sport, ntohs(psrc_m));
177177
MLX5E_FTE_SET(headers_v, tcp_sport, ntohs(psrc_v));
178178
}
179179
if (pdst_m) {
180-
MLX5E_FTE_SET(headers_c, tcp_dport, 0xffff);
180+
MLX5E_FTE_SET(headers_c, tcp_dport, ntohs(pdst_m));
181181
MLX5E_FTE_SET(headers_v, tcp_dport, ntohs(pdst_v));
182182
}
183183

@@ -190,12 +190,12 @@ set_udp(void *headers_c, void *headers_v, __be16 psrc_m, __be16 psrc_v,
190190
__be16 pdst_m, __be16 pdst_v)
191191
{
192192
if (psrc_m) {
193-
MLX5E_FTE_SET(headers_c, udp_sport, 0xffff);
193+
MLX5E_FTE_SET(headers_c, udp_sport, ntohs(psrc_m));
194194
MLX5E_FTE_SET(headers_v, udp_sport, ntohs(psrc_v));
195195
}
196196

197197
if (pdst_m) {
198-
MLX5E_FTE_SET(headers_c, udp_dport, 0xffff);
198+
MLX5E_FTE_SET(headers_c, udp_dport, ntohs(pdst_m));
199199
MLX5E_FTE_SET(headers_v, udp_dport, ntohs(pdst_v));
200200
}
201201

@@ -508,26 +508,14 @@ static int validate_tcpudp4(struct ethtool_rx_flow_spec *fs)
508508
if (l4_mask->tos)
509509
return -EINVAL;
510510

511-
if (l4_mask->ip4src) {
512-
if (!all_ones(l4_mask->ip4src))
513-
return -EINVAL;
511+
if (l4_mask->ip4src)
514512
ntuples++;
515-
}
516-
if (l4_mask->ip4dst) {
517-
if (!all_ones(l4_mask->ip4dst))
518-
return -EINVAL;
513+
if (l4_mask->ip4dst)
519514
ntuples++;
520-
}
521-
if (l4_mask->psrc) {
522-
if (!all_ones(l4_mask->psrc))
523-
return -EINVAL;
515+
if (l4_mask->psrc)
524516
ntuples++;
525-
}
526-
if (l4_mask->pdst) {
527-
if (!all_ones(l4_mask->pdst))
528-
return -EINVAL;
517+
if (l4_mask->pdst)
529518
ntuples++;
530-
}
531519
/* Flow is TCP/UDP */
532520
return ++ntuples;
533521
}
@@ -540,16 +528,10 @@ static int validate_ip4(struct ethtool_rx_flow_spec *fs)
540528
if (l3_mask->l4_4_bytes || l3_mask->tos ||
541529
fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4)
542530
return -EINVAL;
543-
if (l3_mask->ip4src) {
544-
if (!all_ones(l3_mask->ip4src))
545-
return -EINVAL;
531+
if (l3_mask->ip4src)
546532
ntuples++;
547-
}
548-
if (l3_mask->ip4dst) {
549-
if (!all_ones(l3_mask->ip4dst))
550-
return -EINVAL;
533+
if (l3_mask->ip4dst)
551534
ntuples++;
552-
}
553535
if (l3_mask->proto)
554536
ntuples++;
555537
/* Flow is IPv4 */
@@ -588,16 +570,10 @@ static int validate_tcpudp6(struct ethtool_rx_flow_spec *fs)
588570
if (!ipv6_addr_any((struct in6_addr *)l4_mask->ip6dst))
589571
ntuples++;
590572

591-
if (l4_mask->psrc) {
592-
if (!all_ones(l4_mask->psrc))
593-
return -EINVAL;
573+
if (l4_mask->psrc)
594574
ntuples++;
595-
}
596-
if (l4_mask->pdst) {
597-
if (!all_ones(l4_mask->pdst))
598-
return -EINVAL;
575+
if (l4_mask->pdst)
599576
ntuples++;
600-
}
601577
/* Flow is TCP/UDP */
602578
return ++ntuples;
603579
}

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
929929
if (params->rx_dim_enabled)
930930
__set_bit(MLX5E_RQ_STATE_AM, &c->rq.state);
931931

932+
if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)
933+
__set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
934+
932935
return 0;
933936

934937
err_destroy_rq:
@@ -3175,7 +3178,7 @@ static void mlx5e_build_direct_tir_ctx(struct mlx5e_priv *priv, u32 rqtn, u32 *t
31753178
MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_RX_HASH_FN_INVERTED_XOR8);
31763179
}
31773180

3178-
int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv)
3181+
int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
31793182
{
31803183
struct mlx5e_tir *tir;
31813184
void *tirc;
@@ -3202,7 +3205,7 @@ int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv)
32023205
}
32033206
}
32043207

3205-
if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
3208+
if (!inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev))
32063209
goto out;
32073210

32083211
for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++) {
@@ -3273,14 +3276,14 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv)
32733276
return err;
32743277
}
32753278

3276-
void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv)
3279+
void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
32773280
{
32783281
int i;
32793282

32803283
for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
32813284
mlx5e_destroy_tir(priv->mdev, &priv->indir_tir[i]);
32823285

3283-
if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
3286+
if (!inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev))
32843287
return;
32853288

32863289
for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
@@ -4480,6 +4483,31 @@ static u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeo
44804483
return MLX5_CAP_ETH(mdev, lro_timer_supported_periods[i]);
44814484
}
44824485

4486+
void mlx5e_build_rq_params(struct mlx5_core_dev *mdev,
4487+
struct mlx5e_params *params)
4488+
{
4489+
/* Prefer Striding RQ, unless any of the following holds:
4490+
* - Striding RQ configuration is not possible/supported.
4491+
* - Slow PCI heuristic.
4492+
* - Legacy RQ would use linear SKB while Striding RQ would use non-linear.
4493+
*/
4494+
if (!slow_pci_heuristic(mdev) &&
4495+
mlx5e_striding_rq_possible(mdev, params) &&
4496+
(mlx5e_rx_mpwqe_is_linear_skb(mdev, params) ||
4497+
!mlx5e_rx_is_linear_skb(mdev, params)))
4498+
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ, true);
4499+
mlx5e_set_rq_type(mdev, params);
4500+
mlx5e_init_rq_type_params(mdev, params);
4501+
}
4502+
4503+
void mlx5e_build_rss_params(struct mlx5e_params *params)
4504+
{
4505+
params->rss_hfunc = ETH_RSS_HASH_XOR;
4506+
netdev_rss_key_fill(params->toeplitz_hash_key, sizeof(params->toeplitz_hash_key));
4507+
mlx5e_build_default_indir_rqt(params->indirection_rqt,
4508+
MLX5E_INDIR_RQT_SIZE, params->num_channels);
4509+
}
4510+
44834511
void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
44844512
struct mlx5e_params *params,
44854513
u16 max_channels, u16 mtu)
@@ -4503,20 +4531,10 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
45034531
params->rx_cqe_compress_def = slow_pci_heuristic(mdev);
45044532

45054533
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS, params->rx_cqe_compress_def);
4534+
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE, false);
45064535

45074536
/* RQ */
4508-
/* Prefer Striding RQ, unless any of the following holds:
4509-
* - Striding RQ configuration is not possible/supported.
4510-
* - Slow PCI heuristic.
4511-
* - Legacy RQ would use linear SKB while Striding RQ would use non-linear.
4512-
*/
4513-
if (!slow_pci_heuristic(mdev) &&
4514-
mlx5e_striding_rq_possible(mdev, params) &&
4515-
(mlx5e_rx_mpwqe_is_linear_skb(mdev, params) ||
4516-
!mlx5e_rx_is_linear_skb(mdev, params)))
4517-
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_STRIDING_RQ, true);
4518-
mlx5e_set_rq_type(mdev, params);
4519-
mlx5e_init_rq_type_params(mdev, params);
4537+
mlx5e_build_rq_params(mdev, params);
45204538

45214539
/* HW LRO */
45224540

@@ -4539,10 +4557,7 @@ void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
45394557
params->tx_min_inline_mode = mlx5e_params_calculate_tx_min_inline(mdev);
45404558

45414559
/* RSS */
4542-
params->rss_hfunc = ETH_RSS_HASH_XOR;
4543-
netdev_rss_key_fill(params->toeplitz_hash_key, sizeof(params->toeplitz_hash_key));
4544-
mlx5e_build_default_indir_rqt(params->indirection_rqt,
4545-
MLX5E_INDIR_RQT_SIZE, max_channels);
4560+
mlx5e_build_rss_params(params);
45464561
}
45474562

45484563
static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
@@ -4780,7 +4795,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
47804795
if (err)
47814796
goto err_destroy_indirect_rqts;
47824797

4783-
err = mlx5e_create_indirect_tirs(priv);
4798+
err = mlx5e_create_indirect_tirs(priv, true);
47844799
if (err)
47854800
goto err_destroy_direct_rqts;
47864801

@@ -4805,7 +4820,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
48054820
err_destroy_direct_tirs:
48064821
mlx5e_destroy_direct_tirs(priv);
48074822
err_destroy_indirect_tirs:
4808-
mlx5e_destroy_indirect_tirs(priv);
4823+
mlx5e_destroy_indirect_tirs(priv, true);
48094824
err_destroy_direct_rqts:
48104825
mlx5e_destroy_direct_rqts(priv);
48114826
err_destroy_indirect_rqts:
@@ -4822,7 +4837,7 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)
48224837
mlx5e_tc_nic_cleanup(priv);
48234838
mlx5e_destroy_flow_steering(priv);
48244839
mlx5e_destroy_direct_tirs(priv);
4825-
mlx5e_destroy_indirect_tirs(priv);
4840+
mlx5e_destroy_indirect_tirs(priv, true);
48264841
mlx5e_destroy_direct_rqts(priv);
48274842
mlx5e_destroy_rqt(priv, &priv->indir_rqt);
48284843
mlx5e_close_drop_rq(&priv->drop_rq);

0 commit comments

Comments
 (0)