Skip to content

Commit 87c8f84

Browse files
TaeheeYookuba-moo
authored andcommitted
bnxt_en: add support for tcp-data-split ethtool command
NICs that uses bnxt_en driver supports tcp-data-split feature by the name of HDS(header-data-split). But there is no implementation for the HDS to enable by ethtool. Only getting the current HDS status is implemented and The HDS is just automatically enabled only when either LRO, HW-GRO, or JUMBO is enabled. The hds_threshold follows rx-copybreak value. and it was unchangeable. This implements `ethtool -G <interface name> tcp-data-split <value>` command option. The value can be <on> and <auto>. The value is <auto> and one of LRO/GRO/JUMBO is enabled, HDS is automatically enabled and all LRO/GRO/JUMBO are disabled, HDS is automatically disabled. HDS feature relies on the aggregation ring. So, if HDS is enabled, the bnxt_en driver initializes the aggregation ring. This is the reason why BNXT_FLAG_AGG_RINGS contains HDS condition. Acked-by: Jakub Kicinski <[email protected]> Tested-by: Stanislav Fomichev <[email protected]> Tested-by: Andy Gospodarek <[email protected]> Signed-off-by: Taehee Yoo <[email protected]> Reviewed-by: Michael Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 152f4da commit 87c8f84

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4630,7 +4630,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
46304630
bp->rx_agg_ring_size = 0;
46314631
bp->rx_agg_nr_pages = 0;
46324632

4633-
if (bp->flags & BNXT_FLAG_TPA)
4633+
if (bp->flags & BNXT_FLAG_TPA || bp->flags & BNXT_FLAG_HDS)
46344634
agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
46354635

46364636
bp->flags &= ~BNXT_FLAG_JUMBO;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,8 +2244,6 @@ struct bnxt {
22442244
#define BNXT_FLAG_TPA (BNXT_FLAG_LRO | BNXT_FLAG_GRO)
22452245
#define BNXT_FLAG_JUMBO 0x10
22462246
#define BNXT_FLAG_STRIP_VLAN 0x20
2247-
#define BNXT_FLAG_AGG_RINGS (BNXT_FLAG_JUMBO | BNXT_FLAG_GRO | \
2248-
BNXT_FLAG_LRO)
22492247
#define BNXT_FLAG_RFS 0x100
22502248
#define BNXT_FLAG_SHARED_RINGS 0x200
22512249
#define BNXT_FLAG_PORT_STATS 0x400
@@ -2266,6 +2264,9 @@ struct bnxt {
22662264
#define BNXT_FLAG_ROCE_MIRROR_CAP 0x4000000
22672265
#define BNXT_FLAG_TX_COAL_CMPL 0x8000000
22682266
#define BNXT_FLAG_PORT_STATS_EXT 0x10000000
2267+
#define BNXT_FLAG_HDS 0x20000000
2268+
#define BNXT_FLAG_AGG_RINGS (BNXT_FLAG_JUMBO | BNXT_FLAG_GRO | \
2269+
BNXT_FLAG_LRO | BNXT_FLAG_HDS)
22692270

22702271
#define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \
22712272
BNXT_FLAG_RFS | \

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,16 +840,35 @@ static int bnxt_set_ringparam(struct net_device *dev,
840840
struct kernel_ethtool_ringparam *kernel_ering,
841841
struct netlink_ext_ack *extack)
842842
{
843+
u8 tcp_data_split = kernel_ering->tcp_data_split;
843844
struct bnxt *bp = netdev_priv(dev);
845+
u8 hds_config_mod;
844846

845847
if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||
846848
(ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||
847849
(ering->tx_pending < BNXT_MIN_TX_DESC_CNT))
848850
return -EINVAL;
849851

852+
hds_config_mod = tcp_data_split != dev->ethtool->hds_config;
853+
if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_DISABLED && hds_config_mod)
854+
return -EINVAL;
855+
856+
if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
857+
hds_config_mod && BNXT_RX_PAGE_MODE(bp)) {
858+
NL_SET_ERR_MSG_MOD(extack, "tcp-data-split is disallowed when XDP is attached");
859+
return -EINVAL;
860+
}
861+
850862
if (netif_running(dev))
851863
bnxt_close_nic(bp, false, false);
852864

865+
if (hds_config_mod) {
866+
if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED)
867+
bp->flags |= BNXT_FLAG_HDS;
868+
else if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_UNKNOWN)
869+
bp->flags &= ~BNXT_FLAG_HDS;
870+
}
871+
853872
bp->rx_ring_size = ering->rx_pending;
854873
bp->tx_ring_size = ering->tx_pending;
855874
bnxt_set_ring_params(bp);
@@ -5371,6 +5390,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
53715390
ETHTOOL_COALESCE_STATS_BLOCK_USECS |
53725391
ETHTOOL_COALESCE_USE_ADAPTIVE_RX |
53735392
ETHTOOL_COALESCE_USE_CQE,
5393+
.supported_ring_params = ETHTOOL_RING_USE_TCP_DATA_SPLIT,
53745394
.get_link_ksettings = bnxt_get_link_ksettings,
53755395
.set_link_ksettings = bnxt_set_link_ksettings,
53765396
.get_fec_stats = bnxt_get_fec_stats,

drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog)
395395
bp->dev->mtu, BNXT_MAX_PAGE_MODE_MTU);
396396
return -EOPNOTSUPP;
397397
}
398+
if (prog && bp->flags & BNXT_FLAG_HDS) {
399+
netdev_warn(dev, "XDP is disallowed when HDS is enabled.\n");
400+
return -EOPNOTSUPP;
401+
}
398402
if (!(bp->flags & BNXT_FLAG_SHARED_RINGS)) {
399403
netdev_warn(dev, "ethtool rx/tx channels must be combined to support XDP.\n");
400404
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)