aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ethtool.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-09-14 05:10:03 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-15 17:42:13 -0400
commite035587305011432ee07f69f9738b3c7ef7f3684 (patch)
tree46037f2bdd25de4a939c5ba2bd200aded357b418 /include/linux/ethtool.h
parentf833c4c181e4e948758b7b252322f50273100d30 (diff)
ethtool: Complete kernel-doc comments for RX flow filter and hash control
There are now several interfaces within the ethtool API for getting and setting RX flow filtering and hashing behaviour, most of which are poorly documented. This adds kernel-doc comments for all these interfaces, based on the existing incomplete comments and on the initial implementations. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r--include/linux/ethtool.h129
1 files changed, 113 insertions, 16 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 991269e5b152..4b3ba05b11a8 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -314,9 +314,20 @@ enum ethtool_flags {
314}; 314};
315 315
316/* The following structures are for supporting RX network flow 316/* The following structures are for supporting RX network flow
317 * classification configuration. Note, all multibyte fields, e.g., 317 * classification and RX n-tuple configuration. Note, all multibyte
318 * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network 318 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
319 * byte order. 319 * be in network byte order.
320 */
321
322/**
323 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
324 * @ip4src: Source host
325 * @ip4dst: Destination host
326 * @psrc: Source port
327 * @pdst: Destination port
328 * @tos: Type-of-service
329 *
330 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
320 */ 331 */
321struct ethtool_tcpip4_spec { 332struct ethtool_tcpip4_spec {
322 __be32 ip4src; 333 __be32 ip4src;
@@ -326,6 +337,15 @@ struct ethtool_tcpip4_spec {
326 __u8 tos; 337 __u8 tos;
327}; 338};
328 339
340/**
341 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
342 * @ip4src: Source host
343 * @ip4dst: Destination host
344 * @spi: Security parameters index
345 * @tos: Type-of-service
346 *
347 * This can be used to specify an IPsec transport or tunnel over IPv4.
348 */
329struct ethtool_ah_espip4_spec { 349struct ethtool_ah_espip4_spec {
330 __be32 ip4src; 350 __be32 ip4src;
331 __be32 ip4dst; 351 __be32 ip4dst;
@@ -348,6 +368,15 @@ struct ethtool_ether_spec {
348#define ETH_RX_NFC_IP4 1 368#define ETH_RX_NFC_IP4 1
349#define ETH_RX_NFC_IP6 2 369#define ETH_RX_NFC_IP6 2
350 370
371/**
372 * struct ethtool_usrip4_spec - general flow specification for IPv4
373 * @ip4src: Source host
374 * @ip4dst: Destination host
375 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
376 * @tos: Type-of-service
377 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
378 * @proto: Transport protocol number; mask must be 0
379 */
351struct ethtool_usrip4_spec { 380struct ethtool_usrip4_spec {
352 __be32 ip4src; 381 __be32 ip4src;
353 __be32 ip4dst; 382 __be32 ip4dst;
@@ -357,6 +386,15 @@ struct ethtool_usrip4_spec {
357 __u8 proto; 386 __u8 proto;
358}; 387};
359 388
389/**
390 * struct ethtool_rx_flow_spec - specification for RX flow filter
391 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
392 * @h_u: Flow fields to match (dependent on @flow_type)
393 * @m_u: Masks for flow field bits to be ignored
394 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
395 * if packets should be discarded
396 * @location: Index of filter in hardware table
397 */
360struct ethtool_rx_flow_spec { 398struct ethtool_rx_flow_spec {
361 __u32 flow_type; 399 __u32 flow_type;
362 union { 400 union {
@@ -369,32 +407,87 @@ struct ethtool_rx_flow_spec {
369 struct ethtool_ether_spec ether_spec; 407 struct ethtool_ether_spec ether_spec;
370 struct ethtool_usrip4_spec usr_ip4_spec; 408 struct ethtool_usrip4_spec usr_ip4_spec;
371 __u8 hdata[64]; 409 __u8 hdata[64];
372 } h_u, m_u; /* entry, mask */ 410 } h_u, m_u;
373 __u64 ring_cookie; 411 __u64 ring_cookie;
374 __u32 location; 412 __u32 location;
375}; 413};
376 414
415/**
416 * struct ethtool_rxnfc - command to get or set RX flow classification rules
417 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
418 * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
419 * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
420 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
421 * @data: Command-dependent value
422 * @fs: Flow filter specification
423 * @rule_cnt: Number of rules to be affected
424 * @rule_locs: Array of valid rule indices
425 *
426 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
427 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
428 * structure fields must not be used.
429 *
430 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
431 * on return.
432 *
433 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
434 * rules on return.
435 *
436 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the index of an
437 * existing filter rule on entry and @fs contains the rule on return.
438 *
439 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
440 * user buffer for @rule_locs on entry. On return, @data is the size
441 * of the filter table and @rule_locs contains the indices of the
442 * defined rules.
443 *
444 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the filter rule to add or
445 * update. @fs.@location specifies the index to use and must not be
446 * ignored.
447 *
448 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the index of an
449 * existing filter rule on entry.
450 *
451 * Implementation of indexed classification rules generally requires a
452 * TCAM.
453 */
377struct ethtool_rxnfc { 454struct ethtool_rxnfc {
378 __u32 cmd; 455 __u32 cmd;
379 __u32 flow_type; 456 __u32 flow_type;
380 /* The rx flow hash value or the rule DB size */
381 __u64 data; 457 __u64 data;
382 /* The following fields are not valid and must not be used for
383 * the ETHTOOL_{G,X}RXFH commands. */
384 struct ethtool_rx_flow_spec fs; 458 struct ethtool_rx_flow_spec fs;
385 __u32 rule_cnt; 459 __u32 rule_cnt;
386 __u32 rule_locs[0]; 460 __u32 rule_locs[0];
387}; 461};
388 462
463/**
464 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
465 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
466 * @size: On entry, the array size of the user buffer. On return from
467 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
468 * @ring_index: RX ring/queue index for each hash value
469 */
389struct ethtool_rxfh_indir { 470struct ethtool_rxfh_indir {
390 __u32 cmd; 471 __u32 cmd;
391 /* On entry, this is the array size of the user buffer. On
392 * return from ETHTOOL_GRXFHINDIR, this is the array size of
393 * the hardware indirection table. */
394 __u32 size; 472 __u32 size;
395 __u32 ring_index[0]; /* ring/queue index for each hash value */ 473 __u32 ring_index[0];
396}; 474};
397 475
476/**
477 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
478 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
479 * @h_u: Flow field values to match (dependent on @flow_type)
480 * @m_u: Masks for flow field value bits to be ignored
481 * @vlan_tag: VLAN tag to match
482 * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
483 * @data: Driver-dependent data to match
484 * @data_mask: Mask for driver-dependent data bits to be ignored
485 * @action: RX ring/queue index to deliver to (non-negative) or other action
486 * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
487 *
488 * Zero values in @h_u may be ignored, as if all the corresponding
489 * mask bits were set.
490 */
398struct ethtool_rx_ntuple_flow_spec { 491struct ethtool_rx_ntuple_flow_spec {
399 __u32 flow_type; 492 __u32 flow_type;
400 union { 493 union {
@@ -407,18 +500,22 @@ struct ethtool_rx_ntuple_flow_spec {
407 struct ethtool_ether_spec ether_spec; 500 struct ethtool_ether_spec ether_spec;
408 struct ethtool_usrip4_spec usr_ip4_spec; 501 struct ethtool_usrip4_spec usr_ip4_spec;
409 __u8 hdata[64]; 502 __u8 hdata[64];
410 } h_u, m_u; /* entry, mask */ 503 } h_u, m_u;
411 504
412 __u16 vlan_tag; 505 __u16 vlan_tag;
413 __u16 vlan_tag_mask; 506 __u16 vlan_tag_mask;
414 __u64 data; /* user-defined flow spec data */ 507 __u64 data;
415 __u64 data_mask; /* user-defined flow spec mask */ 508 __u64 data_mask;
416 509
417 /* signed to distinguish between queue and actions (DROP) */
418 __s32 action; 510 __s32 action;
419#define ETHTOOL_RXNTUPLE_ACTION_DROP -1 511#define ETHTOOL_RXNTUPLE_ACTION_DROP -1 /* drop packet */
420}; 512};
421 513
514/**
515 * struct ethtool_rx_ntuple - command to set RX flow filter
516 * @cmd: Command number - %ETHTOOL_SRXNTUPLE
517 * @fs: Flow filter specification
518 */
422struct ethtool_rx_ntuple { 519struct ethtool_rx_ntuple {
423 __u32 cmd; 520 __u32 cmd;
424 struct ethtool_rx_ntuple_flow_spec fs; 521 struct ethtool_rx_ntuple_flow_spec fs;