History

ethtool: add tx aggregation parameters

Add the following ethtool tx aggregation parameters: ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES Maximum size in bytes of a tx aggregated block of frames. ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES Maximum number of frames that can be aggregated into a block. ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS Time in usecs after the first packet arrival in an aggregated block for the block to be sent.

Daniele Palmas committed 3 years ago

Commit 31de2841 parent 9a06cce4 files · +51 −3Browse files

Unified · Split

4 files
  1. Documentation/networking/ethtool-netlink.rst +17 −0
  2. include/linux/ethtool.h +11 −1
  3. include/uapi/linux/ethtool_netlink.h +3 −0
  4. net/ethtool/coalesce.c +20 −2
Documentation/networking/ethtool-netlink.rst+17−0
@@ -1004,6 +1004,9 @@ Kernel response contents: · 1003 unmodified lines
1004 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval1004 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
1005 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx1005 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
1006 ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx1006 ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx
1007 ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES`` u32 max aggr size, Tx
1008 ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES`` u32 max aggr packets, Tx
1009 ``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` u32 time (us), aggr, Tx
1007 =========================================== ====== =======================1010 =========================================== ====== =======================
1008 1011
1009Attributes are only included in reply if their value is not zero or the1012Attributes are only included in reply if their value is not zero or the
@@ -1022,6 +1025,17 @@ each packet event resets the timer. In this mode timer is used to force · 12 unmodified lines
1022the interrupt if queue goes idle, while busy queues depend on the packet1025the interrupt if queue goes idle, while busy queues depend on the packet
1023limit to trigger interrupts.1026limit to trigger interrupts.
1024 1027
1028Tx aggregation consists of copying frames into a contiguous buffer so that they
1029can be submitted as a single IO operation. ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES``
1030describes the maximum size in bytes for the submitted buffer.
1031``ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES`` describes the maximum number of frames
1032that can be aggregated into a single buffer.
1033``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` describes the amount of time in usecs,
1034counted since the first packet arrival in an aggregated block, after which the
1035block should be sent.
1036This feature is mainly of interest for specific USB devices which does not cope
1037well with frequent small-sized URBs transmissions.
1038
1025COALESCE_SET1039COALESCE_SET
1026============1040============
1027 1041
@@ -1055,6 +1069,9 @@ Request contents: · 27 unmodified lines
1055 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval1069 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
1056 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx1070 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
1057 ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx1071 ``ETHTOOL_A_COALESCE_USE_CQE_RX`` bool timer reset mode, Rx
1072 ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES`` u32 max aggr size, Tx
1073 ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES`` u32 max aggr packets, Tx
1074 ``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` u32 time (us), aggr, Tx
1058 =========================================== ====== =======================1075 =========================================== ====== =======================
1059 1076
1060Request is rejected if it attributes declared as unsupported by driver (i.e.1077Request is rejected if it attributes declared as unsupported by driver (i.e.
include/linux/ethtool.h+11−1
@@ -217,6 +217,9 @@ __ethtool_get_link_ksettings(struct net_device *dev, · 216 unmodified lines
217struct kernel_ethtool_coalesce {217struct kernel_ethtool_coalesce {
218 u8 use_cqe_mode_tx;218 u8 use_cqe_mode_tx;
219 u8 use_cqe_mode_rx;219 u8 use_cqe_mode_rx;
220 u32 tx_aggr_max_bytes;
221 u32 tx_aggr_max_frames;
222 u32 tx_aggr_time_usecs;
220};223};
221 224
222/**225/**
@@ -260,7 +263,10 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 37 unmodified lines
260#define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21)263#define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21)
261#define ETHTOOL_COALESCE_USE_CQE_RX BIT(22)264#define ETHTOOL_COALESCE_USE_CQE_RX BIT(22)
262#define ETHTOOL_COALESCE_USE_CQE_TX BIT(23)265#define ETHTOOL_COALESCE_USE_CQE_TX BIT(23)
263#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(23, 0)266#define ETHTOOL_COALESCE_TX_AGGR_MAX_BYTES BIT(24)
267#define ETHTOOL_COALESCE_TX_AGGR_MAX_FRAMES BIT(25)
268#define ETHTOOL_COALESCE_TX_AGGR_TIME_USECS BIT(26)
269#define ETHTOOL_COALESCE_ALL_PARAMS GENMASK(26, 0)
264 270
265#define ETHTOOL_COALESCE_USECS \271#define ETHTOOL_COALESCE_USECS \
266 (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS)272 (ETHTOOL_COALESCE_RX_USECS | ETHTOOL_COALESCE_TX_USECS)
@@ -288,6 +294,10 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 21 unmodified lines
288 ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL)294 ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL)
289#define ETHTOOL_COALESCE_USE_CQE \295#define ETHTOOL_COALESCE_USE_CQE \
290 (ETHTOOL_COALESCE_USE_CQE_RX | ETHTOOL_COALESCE_USE_CQE_TX)296 (ETHTOOL_COALESCE_USE_CQE_RX | ETHTOOL_COALESCE_USE_CQE_TX)
297#define ETHTOOL_COALESCE_TX_AGGR \
298 (ETHTOOL_COALESCE_TX_AGGR_MAX_BYTES | \
299 ETHTOOL_COALESCE_TX_AGGR_MAX_FRAMES | \
300 ETHTOOL_COALESCE_TX_AGGR_TIME_USECS)
291 301
292#define ETHTOOL_STAT_NOT_SET (~0ULL)302#define ETHTOOL_STAT_NOT_SET (~0ULL)
293 303
include/uapi/linux/ethtool_netlink.h+3−0
@@ -406,6 +406,9 @@ enum { · 405 unmodified lines
406 ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */406 ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */
407 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX, /* u8 */407 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX, /* u8 */
408 ETHTOOL_A_COALESCE_USE_CQE_MODE_RX, /* u8 */408 ETHTOOL_A_COALESCE_USE_CQE_MODE_RX, /* u8 */
409 ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES, /* u32 */
410 ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES, /* u32 */
411 ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS, /* u32 */
409 412
410 /* add new constants above here */413 /* add new constants above here */
411 __ETHTOOL_A_COALESCE_CNT,414 __ETHTOOL_A_COALESCE_CNT,
net/ethtool/coalesce.c+20−2
@@ -105,7 +105,10 @@ static int coalesce_reply_size(const struct ethnl_req_info *req_base, · 104 unmodified lines
105 nla_total_size(sizeof(u32)) + /* _TX_MAX_FRAMES_HIGH */105 nla_total_size(sizeof(u32)) + /* _TX_MAX_FRAMES_HIGH */
106 nla_total_size(sizeof(u32)) + /* _RATE_SAMPLE_INTERVAL */106 nla_total_size(sizeof(u32)) + /* _RATE_SAMPLE_INTERVAL */
107 nla_total_size(sizeof(u8)) + /* _USE_CQE_MODE_TX */107 nla_total_size(sizeof(u8)) + /* _USE_CQE_MODE_TX */
108 nla_total_size(sizeof(u8)); /* _USE_CQE_MODE_RX */108 nla_total_size(sizeof(u8)) + /* _USE_CQE_MODE_RX */
109 nla_total_size(sizeof(u32)) + /* _TX_AGGR_MAX_BYTES */
110 nla_total_size(sizeof(u32)) + /* _TX_AGGR_MAX_FRAMES */
111 nla_total_size(sizeof(u32)); /* _TX_AGGR_TIME_USECS */
109}112}
110 113
111static bool coalesce_put_u32(struct sk_buff *skb, u16 attr_type, u32 val,114static bool coalesce_put_u32(struct sk_buff *skb, u16 attr_type, u32 val,
@@ -180,7 +183,13 @@ static int coalesce_fill_reply(struct sk_buff *skb, · 68 unmodified lines
180 coalesce_put_bool(skb, ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,183 coalesce_put_bool(skb, ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,
181 kcoal->use_cqe_mode_tx, supported) ||184 kcoal->use_cqe_mode_tx, supported) ||
182 coalesce_put_bool(skb, ETHTOOL_A_COALESCE_USE_CQE_MODE_RX,185 coalesce_put_bool(skb, ETHTOOL_A_COALESCE_USE_CQE_MODE_RX,
183 kcoal->use_cqe_mode_rx, supported))186 kcoal->use_cqe_mode_rx, supported) ||
187 coalesce_put_u32(skb, ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES,
188 kcoal->tx_aggr_max_bytes, supported) ||
189 coalesce_put_u32(skb, ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES,
190 kcoal->tx_aggr_max_frames, supported) ||
191 coalesce_put_u32(skb, ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS,
192 kcoal->tx_aggr_time_usecs, supported))
184 return -EMSGSIZE;193 return -EMSGSIZE;
185 194
186 return 0;195 return 0;
@@ -227,6 +236,9 @@ const struct nla_policy ethnl_coalesce_set_policy[] = { · 40 unmodified lines
227 [ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL] = { .type = NLA_U32 },236 [ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL] = { .type = NLA_U32 },
228 [ETHTOOL_A_COALESCE_USE_CQE_MODE_TX] = NLA_POLICY_MAX(NLA_U8, 1),237 [ETHTOOL_A_COALESCE_USE_CQE_MODE_TX] = NLA_POLICY_MAX(NLA_U8, 1),
229 [ETHTOOL_A_COALESCE_USE_CQE_MODE_RX] = NLA_POLICY_MAX(NLA_U8, 1),238 [ETHTOOL_A_COALESCE_USE_CQE_MODE_RX] = NLA_POLICY_MAX(NLA_U8, 1),
239 [ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES] = { .type = NLA_U32 },
240 [ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES] = { .type = NLA_U32 },
241 [ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS] = { .type = NLA_U32 },
230};242};
231 243
232int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)244int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)
@@ -321,6 +333,12 @@ int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info) · 88 unmodified lines
321 tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX], &mod);333 tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX], &mod);
322 ethnl_update_u8(&kernel_coalesce.use_cqe_mode_rx,334 ethnl_update_u8(&kernel_coalesce.use_cqe_mode_rx,
323 tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX], &mod);335 tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX], &mod);
336 ethnl_update_u32(&kernel_coalesce.tx_aggr_max_bytes,
337 tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES], &mod);
338 ethnl_update_u32(&kernel_coalesce.tx_aggr_max_frames,
339 tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES], &mod);
340 ethnl_update_u32(&kernel_coalesce.tx_aggr_time_usecs,
341 tb[ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS], &mod);
324 ret = 0;342 ret = 0;
325 if (!mod)343 if (!mod)
326 goto out_ops;344 goto out_ops;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t