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
10041004 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
10051005 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
10061006 ``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
10071010 =========================================== ====== =======================
10081011
10091012 Attributes 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
10221025 the interrupt if queue goes idle, while busy queues depend on the packet
10231026 limit to trigger interrupts.
10241027
1028+Tx aggregation consists of copying frames into a contiguous buffer so that they
1029+can be submitted as a single IO operation. ``ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES``
1030+describes the maximum size in bytes for the submitted buffer.
1031+``ETHTOOL_A_COALESCE_TX_AGGR_MAX_FRAMES`` describes the maximum number of frames
1032+that can be aggregated into a single buffer.
1033+``ETHTOOL_A_COALESCE_TX_AGGR_TIME_USECS`` describes the amount of time in usecs,
1034+counted since the first packet arrival in an aggregated block, after which the
1035+block should be sent.
1036+This feature is mainly of interest for specific USB devices which does not cope
1037+well with frequent small-sized URBs transmissions.
1038+
10251039 COALESCE_SET
10261040 ============
10271041
@@ -1055,6 +1069,9 @@ Request contents: · 27 unmodified lines
10551069 ``ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL`` u32 rate sampling interval
10561070 ``ETHTOOL_A_COALESCE_USE_CQE_TX`` bool timer reset mode, Tx
10571071 ``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
10581075 =========================================== ====== =======================
10591076
10601077 Request 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
217217 struct kernel_ethtool_coalesce {
218218 u8 use_cqe_mode_tx;
219219 u8 use_cqe_mode_rx;
220+ u32 tx_aggr_max_bytes;
221+ u32 tx_aggr_max_frames;
222+ u32 tx_aggr_time_usecs;
220223 };
221224
222225 /**
@@ -260,7 +263,10 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, · 37 unmodified lines
260263 #define ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL BIT(21)
261264 #define ETHTOOL_COALESCE_USE_CQE_RX BIT(22)
262265 #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)
264270
265271 #define ETHTOOL_COALESCE_USECS \
266272 (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
288294 ETHTOOL_COALESCE_RATE_SAMPLE_INTERVAL)
289295 #define ETHTOOL_COALESCE_USE_CQE \
290296 (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)
291301
292302 #define ETHTOOL_STAT_NOT_SET (~0ULL)
293303
include/uapi/linux/ethtool_netlink.h+3−0
@@ -406,6 +406,9 @@ enum { · 405 unmodified lines
406406 ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL, /* u32 */
407407 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX, /* u8 */
408408 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 */
409412
410413 /* add new constants above here */
411414 __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
105105 nla_total_size(sizeof(u32)) + /* _TX_MAX_FRAMES_HIGH */
106106 nla_total_size(sizeof(u32)) + /* _RATE_SAMPLE_INTERVAL */
107107 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 */
109112 }
110113
111114 static 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
180183 coalesce_put_bool(skb, ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,
181184 kcoal->use_cqe_mode_tx, supported) ||
182185 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))
184193 return -EMSGSIZE;
185194
186195 return 0;
@@ -227,6 +236,9 @@ const struct nla_policy ethnl_coalesce_set_policy[] = { · 40 unmodified lines
227236 [ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL] = { .type = NLA_U32 },
228237 [ETHTOOL_A_COALESCE_USE_CQE_MODE_TX] = NLA_POLICY_MAX(NLA_U8, 1),
229238 [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 },
230242 };
231243
232244 int 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
321333 tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX], &mod);
322334 ethnl_update_u8(&kernel_coalesce.use_cqe_mode_rx,
323335 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);
324342 ret = 0;
325343 if (!mod)
326344 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