Skip to content

Commit 3a62c33

Browse files
committed
Merge branch 'ethtool-extend-coalesce-uapi'
Yufeng Mo says: ==================== ethtool: extend coalesce uAPI In order to support some configuration in coalesce uAPI, this series extend coalesce uAPI and add support for CQE mode. Below is some test result with HNS3 driver: 1. old ethtool(ioctl) + new kernel: estuary:/$ ethtool -c eth0 Coalesce parameters for eth0: Adaptive RX: on TX: on stats-block-usecs: 0 sample-interval: 0 pkt-rate-low: 0 pkt-rate-high: 0 rx-usecs: 20 rx-frames: 0 rx-usecs-irq: 0 rx-frames-irq: 0 tx-usecs: 20 tx-frames: 0 tx-usecs-irq: 0 tx-frames-irq: 0 rx-usecs-low: 0 rx-frame-low: 0 tx-usecs-low: 0 tx-frame-low: 0 rx-usecs-high: 0 rx-frame-high: 0 tx-usecs-high: 0 tx-frame-high: 0 2. ethtool(netlink with cqe mode) + kernel without cqe mode: estuary:/$ ethtool -c eth0 Coalesce parameters for eth0: Adaptive RX: on TX: on stats-block-usecs: n/a sample-interval: n/a pkt-rate-low: n/a pkt-rate-high: n/a rx-usecs: 20 rx-frames: 0 rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 20 tx-frames: 0 tx-usecs-irq: n/a tx-frames-irq: n/a rx-usecs-low: n/a rx-frame-low: n/a tx-usecs-low: n/a tx-frame-low: n/a rx-usecs-high: 0 rx-frame-high: n/a tx-usecs-high: 0 tx-frame-high: n/a CQE mode RX: n/a TX: n/a 3. ethool(netlink with cqe mode) + kernel with cqe mode: estuary:/$ ethtool -c eth0 Coalesce parameters for eth0: Adaptive RX: on TX: on stats-block-usecs: n/a sample-interval: n/a pkt-rate-low: n/a pkt-rate-high: n/a rx-usecs: 20 rx-frames: 0 rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 20 tx-frames: 0 tx-usecs-irq: n/a tx-frames-irq: n/a rx-usecs-low: n/a rx-frame-low: n/a tx-usecs-low: n/a tx-frame-low: n/a rx-usecs-high: 0 rx-frame-high: n/a tx-usecs-high: 0 tx-frame-high: n/a CQE mode RX: off TX: off 4. ethool(netlink without cqe mode) + kernel with cqe mode: estuary:/$ ethtool -c eth0 Coalesce parameters for eth0: Adaptive RX: on TX: on stats-block-usecs: n/a sample-interval: n/a pkt-rate-low: n/a pkt-rate-high: n/a rx-usecs: 20 rx-frames: 0 rx-usecs-irq: n/a rx-frames-irq: n/a tx-usecs: 20 tx-frames: 0 tx-usecs-irq: n/a tx-frames-irq: n/a rx-usecs-low: n/a rx-frame-low: n/a tx-usecs-low: n/a tx-frame-low: n/a rx-usecs-high: 0 rx-frame-high: n/a tx-usecs-high: 0 tx-frame-high: n/a Change log: V2 -> V3: fix some warning on W=1 builds in #2 V1 -> V2: 1. fix compile error using allmodconfig in #2 2. move some property-related modifications from #2 to #1 for better review suggested by Jakub Kicinski. Change log from RFC: V3 -> V4: add document explaining the difference between CQE and EQE in #1 suggested by Jakub Kicinski. V2 -> V3: 1. split #1 into adding new parameter and adding new attributes. 2. use NLA_POLICY_MAX(NLA_U8, 1) instead of NLA_U8. 3. modify the description of CQE in Document. V1 -> V2: refactor #1&#2 in V1 suggestted by Jakub Kicinski. ==================== Link: https://lore.kernel.org/r/1629444920-25437-1-git-send-email-moyufeng@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 95d1d24 + cce1689 commit 3a62c33

File tree

93 files changed

+699
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+699
-209
lines changed

Documentation/networking/ethtool-netlink.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,25 @@ Kernel response contents:
947947
``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx
948948
``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx
949949
``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
950+
``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
951+
``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx
950952
=========================================== ====== =======================
951953

952954
Attributes are only included in reply if their value is not zero or the
953955
corresponding bit in ``ethtool_ops::supported_coalesce_params`` is set (i.e.
954956
they are declared as supported by driver).
955957

958+
Timer reset mode (``ETHTOOL_A_COALESCE_USE_CQE_TX`` and
959+
``ETHTOOL_A_COALESCE_USE_CQE_RX``) controls the interaction between packet
960+
arrival and the various time based delay parameters. By default timers are
961+
expected to limit the max delay between any packet arrival/departure and a
962+
corresponding interrupt. In this mode timer should be started by packet
963+
arrival (sometimes delivery of previous interrupt) and reset when interrupt
964+
is delivered.
965+
Setting the appropriate attribute to 1 will enable ``CQE`` mode, where
966+
each packet event resets the timer. In this mode timer is used to force
967+
the interrupt if queue goes idle, while busy queues depend on the packet
968+
limit to trigger interrupts.
956969

957970
COALESCE_SET
958971
============
@@ -985,6 +998,8 @@ Request contents:
985998
``ETHTOOL_A_COALESCE_TX_USECS_HIGH`` u32 delay (us), high Tx
986999
``ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH`` u32 max packets, high Tx
9871000
``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
1001+
``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
1002+
``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx
9881003
=========================================== ====== =======================
9891004

9901005
Request is rejected if it attributes declared as unsupported by driver (i.e.

drivers/infiniband/ulp/ipoib/ipoib_ethtool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ static void ipoib_get_drvinfo(struct net_device *netdev,
7272
}
7373

7474
static int ipoib_get_coalesce(struct net_device *dev,
75-
struct ethtool_coalesce *coal)
75+
struct ethtool_coalesce *coal,
76+
struct kernel_ethtool_coalesce *kernel_coal,
77+
struct netlink_ext_ack *extack)
7678
{
7779
struct ipoib_dev_priv *priv = ipoib_priv(dev);
7880

@@ -83,7 +85,9 @@ static int ipoib_get_coalesce(struct net_device *dev,
8385
}
8486

8587
static int ipoib_set_coalesce(struct net_device *dev,
86-
struct ethtool_coalesce *coal)
88+
struct ethtool_coalesce *coal,
89+
struct kernel_ethtool_coalesce *kernel_coal,
90+
struct netlink_ext_ack *extack)
8791
{
8892
struct ipoib_dev_priv *priv = ipoib_priv(dev);
8993
int ret;

drivers/net/ethernet/amazon/ena/ena_ethtool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ static int ena_get_link_ksettings(struct net_device *netdev,
357357
}
358358

359359
static int ena_get_coalesce(struct net_device *net_dev,
360-
struct ethtool_coalesce *coalesce)
360+
struct ethtool_coalesce *coalesce,
361+
struct kernel_ethtool_coalesce *kernel_coal,
362+
struct netlink_ext_ack *extack)
361363
{
362364
struct ena_adapter *adapter = netdev_priv(net_dev);
363365
struct ena_com_dev *ena_dev = adapter->ena_dev;
@@ -402,7 +404,9 @@ static void ena_update_rx_rings_nonadaptive_intr_moderation(struct ena_adapter *
402404
}
403405

404406
static int ena_set_coalesce(struct net_device *net_dev,
405-
struct ethtool_coalesce *coalesce)
407+
struct ethtool_coalesce *coalesce,
408+
struct kernel_ethtool_coalesce *kernel_coal,
409+
struct netlink_ext_ack *extack)
406410
{
407411
struct ena_adapter *adapter = netdev_priv(net_dev);
408412
struct ena_com_dev *ena_dev = adapter->ena_dev;

drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ static void xgbe_set_msglevel(struct net_device *netdev, u32 msglevel)
428428
}
429429

430430
static int xgbe_get_coalesce(struct net_device *netdev,
431-
struct ethtool_coalesce *ec)
431+
struct ethtool_coalesce *ec,
432+
struct kernel_ethtool_coalesce *kernel_coal,
433+
struct netlink_ext_ack *extack)
432434
{
433435
struct xgbe_prv_data *pdata = netdev_priv(netdev);
434436

@@ -443,7 +445,9 @@ static int xgbe_get_coalesce(struct net_device *netdev,
443445
}
444446

445447
static int xgbe_set_coalesce(struct net_device *netdev,
446-
struct ethtool_coalesce *ec)
448+
struct ethtool_coalesce *ec,
449+
struct kernel_ethtool_coalesce *kernel_coal,
450+
struct netlink_ext_ack *extack)
447451
{
448452
struct xgbe_prv_data *pdata = netdev_priv(netdev);
449453
struct xgbe_hw_if *hw_if = &pdata->hw_if;

drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,9 @@ static int aq_ethtool_set_rxnfc(struct net_device *ndev,
547547
}
548548

549549
static int aq_ethtool_get_coalesce(struct net_device *ndev,
550-
struct ethtool_coalesce *coal)
550+
struct ethtool_coalesce *coal,
551+
struct kernel_ethtool_coalesce *kernel_coal,
552+
struct netlink_ext_ack *extack)
551553
{
552554
struct aq_nic_s *aq_nic = netdev_priv(ndev);
553555
struct aq_nic_cfg_s *cfg;
@@ -571,7 +573,9 @@ static int aq_ethtool_get_coalesce(struct net_device *ndev,
571573
}
572574

573575
static int aq_ethtool_set_coalesce(struct net_device *ndev,
574-
struct ethtool_coalesce *coal)
576+
struct ethtool_coalesce *coal,
577+
struct kernel_ethtool_coalesce *kernel_coal,
578+
struct netlink_ext_ack *extack)
575579
{
576580
struct aq_nic_s *aq_nic = netdev_priv(ndev);
577581
struct aq_nic_cfg_s *cfg;

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ static void bcm_sysport_set_tx_coalesce(struct bcm_sysport_tx_ring *ring,
607607
}
608608

609609
static int bcm_sysport_get_coalesce(struct net_device *dev,
610-
struct ethtool_coalesce *ec)
610+
struct ethtool_coalesce *ec,
611+
struct kernel_ethtool_coalesce *kernel_coal,
612+
struct netlink_ext_ack *extack)
611613
{
612614
struct bcm_sysport_priv *priv = netdev_priv(dev);
613615
u32 reg;
@@ -627,7 +629,9 @@ static int bcm_sysport_get_coalesce(struct net_device *dev,
627629
}
628630

629631
static int bcm_sysport_set_coalesce(struct net_device *dev,
630-
struct ethtool_coalesce *ec)
632+
struct ethtool_coalesce *ec,
633+
struct kernel_ethtool_coalesce *kernel_coal,
634+
struct netlink_ext_ack *extack)
631635
{
632636
struct bcm_sysport_priv *priv = netdev_priv(dev);
633637
struct dim_cq_moder moder;

drivers/net/ethernet/broadcom/bnx2.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7242,8 +7242,10 @@ bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
72427242
return rc;
72437243
}
72447244

7245-
static int
7246-
bnx2_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
7245+
static int bnx2_get_coalesce(struct net_device *dev,
7246+
struct ethtool_coalesce *coal,
7247+
struct kernel_ethtool_coalesce *kernel_coal,
7248+
struct netlink_ext_ack *extack)
72477249
{
72487250
struct bnx2 *bp = netdev_priv(dev);
72497251

@@ -7264,8 +7266,10 @@ bnx2_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
72647266
return 0;
72657267
}
72667268

7267-
static int
7268-
bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
7269+
static int bnx2_set_coalesce(struct net_device *dev,
7270+
struct ethtool_coalesce *coal,
7271+
struct kernel_ethtool_coalesce *kernel_coal,
7272+
struct netlink_ext_ack *extack)
72697273
{
72707274
struct bnx2 *bp = netdev_priv(dev);
72717275

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,9 @@ static int bnx2x_set_eeprom(struct net_device *dev,
18781878
}
18791879

18801880
static int bnx2x_get_coalesce(struct net_device *dev,
1881-
struct ethtool_coalesce *coal)
1881+
struct ethtool_coalesce *coal,
1882+
struct kernel_ethtool_coalesce *kernel_coal,
1883+
struct netlink_ext_ack *extack)
18821884
{
18831885
struct bnx2x *bp = netdev_priv(dev);
18841886

@@ -1891,7 +1893,9 @@ static int bnx2x_get_coalesce(struct net_device *dev,
18911893
}
18921894

18931895
static int bnx2x_set_coalesce(struct net_device *dev,
1894-
struct ethtool_coalesce *coal)
1896+
struct ethtool_coalesce *coal,
1897+
struct kernel_ethtool_coalesce *kernel_coal,
1898+
struct netlink_ext_ack *extack)
18951899
{
18961900
struct bnx2x *bp = netdev_priv(dev);
18971901

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ static void bnxt_set_msglevel(struct net_device *dev, u32 value)
4949
}
5050

5151
static int bnxt_get_coalesce(struct net_device *dev,
52-
struct ethtool_coalesce *coal)
52+
struct ethtool_coalesce *coal,
53+
struct kernel_ethtool_coalesce *kernel_coal,
54+
struct netlink_ext_ack *extack)
5355
{
5456
struct bnxt *bp = netdev_priv(dev);
5557
struct bnxt_coal *hw_coal;
@@ -79,7 +81,9 @@ static int bnxt_get_coalesce(struct net_device *dev,
7981
}
8082

8183
static int bnxt_set_coalesce(struct net_device *dev,
82-
struct ethtool_coalesce *coal)
84+
struct ethtool_coalesce *coal,
85+
struct kernel_ethtool_coalesce *kernel_coal,
86+
struct netlink_ext_ack *extack)
8387
{
8488
struct bnxt *bp = netdev_priv(dev);
8589
bool update_stats = false;

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,9 @@ static void bcmgenet_set_msglevel(struct net_device *dev, u32 level)
828828
}
829829

830830
static int bcmgenet_get_coalesce(struct net_device *dev,
831-
struct ethtool_coalesce *ec)
831+
struct ethtool_coalesce *ec,
832+
struct kernel_ethtool_coalesce *kernel_coal,
833+
struct netlink_ext_ack *extack)
832834
{
833835
struct bcmgenet_priv *priv = netdev_priv(dev);
834836
struct bcmgenet_rx_ring *ring;
@@ -890,7 +892,9 @@ static void bcmgenet_set_ring_rx_coalesce(struct bcmgenet_rx_ring *ring,
890892
}
891893

892894
static int bcmgenet_set_coalesce(struct net_device *dev,
893-
struct ethtool_coalesce *ec)
895+
struct ethtool_coalesce *ec,
896+
struct kernel_ethtool_coalesce *kernel_coal,
897+
struct netlink_ext_ack *extack)
894898
{
895899
struct bcmgenet_priv *priv = netdev_priv(dev);
896900
unsigned int i;

0 commit comments

Comments
 (0)