Skip to content

Commit f858cc9

Browse files
edumazetkuba-moo
authored andcommitted
net: add IFLA_MAX_PACING_OFFLOAD_HORIZON device attribute
Some network devices have the ability to offload EDT (Earliest Departure Time) which is the model used for TCP pacing and FQ packet scheduler. Some of them implement the timing wheel mechanism described in https://saeed.github.io/files/carousel-sigcomm17.pdf with an associated 'timing wheel horizon'. This patch adds dev->max_pacing_offload_horizon expressing this timing wheel horizon in nsec units. This is a read-only attribute. Unless a driver sets it, dev->max_pacing_offload_horizon is zero. v2: addressed Jakub feedback ( https://lore.kernel.org/netdev/20240930152304.472767-2-edumazet@google.com/T/#mf6294d714c41cc459962154cc2580ce3c9693663 ) v3: added yaml doc (also per Jakub feedback) Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20241003121219.2396589-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3d07b69 commit f858cc9

File tree

6 files changed

+15
-0
lines changed

6 files changed

+15
-0
lines changed

Documentation/netlink/specs/rt_link.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,10 @@ attribute-sets:
11371137
name: dpll-pin
11381138
type: nest
11391139
nested-attributes: link-dpll-pin-attrs
1140+
-
1141+
name: max-pacing-offload-horizon
1142+
type: uint
1143+
doc: EDT offload horizon supported by the device (in nsec).
11401144
-
11411145
name: af-spec-attrs
11421146
attributes:

Documentation/networking/net_cachelines/net_device.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,4 @@ struct_devlink_port* devlink_port
183183
struct_dpll_pin* dpll_pin
184184
struct hlist_head page_pools
185185
struct dim_irq_moder* irq_moder
186+
u64 max_pacing_offload_horizon

include/linux/netdevice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,8 @@ enum netdev_reg_state {
20092009
* @dpll_pin: Pointer to the SyncE source pin of a DPLL subsystem,
20102010
* where the clock is recovered.
20112011
*
2012+
* @max_pacing_offload_horizon: max EDT offload horizon in nsec.
2013+
*
20122014
* FIXME: cleanup struct net_device such that network protocol info
20132015
* moves out.
20142016
*/
@@ -2399,6 +2401,8 @@ struct net_device {
23992401
/** @irq_moder: dim parameters used if IS_ENABLED(CONFIG_DIMLIB). */
24002402
struct dim_irq_moder *irq_moder;
24012403

2404+
u64 max_pacing_offload_horizon;
2405+
24022406
u8 priv[] ____cacheline_aligned
24032407
__counted_by(priv_len);
24042408
} ____cacheline_aligned;

include/uapi/linux/if_link.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ enum {
377377
IFLA_GSO_IPV4_MAX_SIZE,
378378
IFLA_GRO_IPV4_MAX_SIZE,
379379
IFLA_DPLL_PIN,
380+
IFLA_MAX_PACING_OFFLOAD_HORIZON,
380381
__IFLA_MAX
381382
};
382383

net/core/rtnetlink.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
11181118
+ nla_total_size(MAX_ADDR_LEN) /* IFLA_PERM_ADDRESS */
11191119
+ rtnl_devlink_port_size(dev)
11201120
+ rtnl_dpll_pin_size(dev)
1121+
+ nla_total_size(8) /* IFLA_MAX_PACING_OFFLOAD_HORIZON */
11211122
+ 0;
11221123
}
11231124

@@ -1867,6 +1868,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
18671868
READ_ONCE(dev->tso_max_size)) ||
18681869
nla_put_u32(skb, IFLA_TSO_MAX_SEGS,
18691870
READ_ONCE(dev->tso_max_segs)) ||
1871+
nla_put_uint(skb, IFLA_MAX_PACING_OFFLOAD_HORIZON,
1872+
READ_ONCE(dev->max_pacing_offload_horizon)) ||
18701873
#ifdef CONFIG_RPS
18711874
nla_put_u32(skb, IFLA_NUM_RX_QUEUES,
18721875
READ_ONCE(dev->num_rx_queues)) ||
@@ -1975,6 +1978,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
19751978
}
19761979

19771980
static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
1981+
[IFLA_UNSPEC] = { .strict_start_type = IFLA_DPLL_PIN },
19781982
[IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
19791983
[IFLA_ADDRESS] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },
19801984
[IFLA_BROADCAST] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },

tools/include/uapi/linux/if_link.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ enum {
377377
IFLA_GSO_IPV4_MAX_SIZE,
378378
IFLA_GRO_IPV4_MAX_SIZE,
379379
IFLA_DPLL_PIN,
380+
IFLA_MAX_PACING_OFFLOAD_HORIZON,
380381
__IFLA_MAX
381382
};
382383

0 commit comments

Comments
 (0)