diff options
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r-- | include/linux/ethtool.h | 190 |
1 files changed, 139 insertions, 51 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 991269e5b152..6628a507fd3b 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define _LINUX_ETHTOOL_H | 14 | #define _LINUX_ETHTOOL_H |
15 | 15 | ||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/if_ether.h> | ||
17 | 18 | ||
18 | /* This should work for both 32 and 64 bit userland. */ | 19 | /* This should work for both 32 and 64 bit userland. */ |
19 | struct ethtool_cmd { | 20 | struct ethtool_cmd { |
@@ -308,15 +309,28 @@ struct ethtool_perm_addr { | |||
308 | * flag differs from the read-only value. | 309 | * flag differs from the read-only value. |
309 | */ | 310 | */ |
310 | enum ethtool_flags { | 311 | enum ethtool_flags { |
312 | ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ | ||
313 | ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ | ||
311 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | 314 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ |
312 | ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ | 315 | ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ |
313 | ETH_FLAG_RXHASH = (1 << 28), | 316 | ETH_FLAG_RXHASH = (1 << 28), |
314 | }; | 317 | }; |
315 | 318 | ||
316 | /* The following structures are for supporting RX network flow | 319 | /* The following structures are for supporting RX network flow |
317 | * classification configuration. Note, all multibyte fields, e.g., | 320 | * classification and RX n-tuple configuration. Note, all multibyte |
318 | * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network | 321 | * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to |
319 | * byte order. | 322 | * be in network byte order. |
323 | */ | ||
324 | |||
325 | /** | ||
326 | * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. | ||
327 | * @ip4src: Source host | ||
328 | * @ip4dst: Destination host | ||
329 | * @psrc: Source port | ||
330 | * @pdst: Destination port | ||
331 | * @tos: Type-of-service | ||
332 | * | ||
333 | * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. | ||
320 | */ | 334 | */ |
321 | struct ethtool_tcpip4_spec { | 335 | struct ethtool_tcpip4_spec { |
322 | __be32 ip4src; | 336 | __be32 ip4src; |
@@ -326,6 +340,15 @@ struct ethtool_tcpip4_spec { | |||
326 | __u8 tos; | 340 | __u8 tos; |
327 | }; | 341 | }; |
328 | 342 | ||
343 | /** | ||
344 | * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 | ||
345 | * @ip4src: Source host | ||
346 | * @ip4dst: Destination host | ||
347 | * @spi: Security parameters index | ||
348 | * @tos: Type-of-service | ||
349 | * | ||
350 | * This can be used to specify an IPsec transport or tunnel over IPv4. | ||
351 | */ | ||
329 | struct ethtool_ah_espip4_spec { | 352 | struct ethtool_ah_espip4_spec { |
330 | __be32 ip4src; | 353 | __be32 ip4src; |
331 | __be32 ip4dst; | 354 | __be32 ip4dst; |
@@ -333,21 +356,17 @@ struct ethtool_ah_espip4_spec { | |||
333 | __u8 tos; | 356 | __u8 tos; |
334 | }; | 357 | }; |
335 | 358 | ||
336 | struct ethtool_rawip4_spec { | ||
337 | __be32 ip4src; | ||
338 | __be32 ip4dst; | ||
339 | __u8 hdata[64]; | ||
340 | }; | ||
341 | |||
342 | struct ethtool_ether_spec { | ||
343 | __be16 ether_type; | ||
344 | __u8 frame_size; | ||
345 | __u8 eframe[16]; | ||
346 | }; | ||
347 | |||
348 | #define ETH_RX_NFC_IP4 1 | 359 | #define ETH_RX_NFC_IP4 1 |
349 | #define ETH_RX_NFC_IP6 2 | ||
350 | 360 | ||
361 | /** | ||
362 | * struct ethtool_usrip4_spec - general flow specification for IPv4 | ||
363 | * @ip4src: Source host | ||
364 | * @ip4dst: Destination host | ||
365 | * @l4_4_bytes: First 4 bytes of transport (layer 4) header | ||
366 | * @tos: Type-of-service | ||
367 | * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 | ||
368 | * @proto: Transport protocol number; mask must be 0 | ||
369 | */ | ||
351 | struct ethtool_usrip4_spec { | 370 | struct ethtool_usrip4_spec { |
352 | __be32 ip4src; | 371 | __be32 ip4src; |
353 | __be32 ip4dst; | 372 | __be32 ip4dst; |
@@ -357,6 +376,15 @@ struct ethtool_usrip4_spec { | |||
357 | __u8 proto; | 376 | __u8 proto; |
358 | }; | 377 | }; |
359 | 378 | ||
379 | /** | ||
380 | * struct ethtool_rx_flow_spec - specification for RX flow filter | ||
381 | * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW | ||
382 | * @h_u: Flow fields to match (dependent on @flow_type) | ||
383 | * @m_u: Masks for flow field bits to be ignored | ||
384 | * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC | ||
385 | * if packets should be discarded | ||
386 | * @location: Index of filter in hardware table | ||
387 | */ | ||
360 | struct ethtool_rx_flow_spec { | 388 | struct ethtool_rx_flow_spec { |
361 | __u32 flow_type; | 389 | __u32 flow_type; |
362 | union { | 390 | union { |
@@ -365,36 +393,91 @@ struct ethtool_rx_flow_spec { | |||
365 | struct ethtool_tcpip4_spec sctp_ip4_spec; | 393 | struct ethtool_tcpip4_spec sctp_ip4_spec; |
366 | struct ethtool_ah_espip4_spec ah_ip4_spec; | 394 | struct ethtool_ah_espip4_spec ah_ip4_spec; |
367 | struct ethtool_ah_espip4_spec esp_ip4_spec; | 395 | struct ethtool_ah_espip4_spec esp_ip4_spec; |
368 | struct ethtool_rawip4_spec raw_ip4_spec; | ||
369 | struct ethtool_ether_spec ether_spec; | ||
370 | struct ethtool_usrip4_spec usr_ip4_spec; | 396 | struct ethtool_usrip4_spec usr_ip4_spec; |
371 | __u8 hdata[64]; | 397 | struct ethhdr ether_spec; |
372 | } h_u, m_u; /* entry, mask */ | 398 | __u8 hdata[72]; |
399 | } h_u, m_u; | ||
373 | __u64 ring_cookie; | 400 | __u64 ring_cookie; |
374 | __u32 location; | 401 | __u32 location; |
375 | }; | 402 | }; |
376 | 403 | ||
404 | /** | ||
405 | * struct ethtool_rxnfc - command to get or set RX flow classification rules | ||
406 | * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, | ||
407 | * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, | ||
408 | * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS | ||
409 | * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW | ||
410 | * @data: Command-dependent value | ||
411 | * @fs: Flow filter specification | ||
412 | * @rule_cnt: Number of rules to be affected | ||
413 | * @rule_locs: Array of valid rule indices | ||
414 | * | ||
415 | * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating | ||
416 | * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following | ||
417 | * structure fields must not be used. | ||
418 | * | ||
419 | * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues | ||
420 | * on return. | ||
421 | * | ||
422 | * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined | ||
423 | * rules on return. | ||
424 | * | ||
425 | * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the index of an | ||
426 | * existing filter rule on entry and @fs contains the rule on return. | ||
427 | * | ||
428 | * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the | ||
429 | * user buffer for @rule_locs on entry. On return, @data is the size | ||
430 | * of the filter table and @rule_locs contains the indices of the | ||
431 | * defined rules. | ||
432 | * | ||
433 | * For %ETHTOOL_SRXCLSRLINS, @fs specifies the filter rule to add or | ||
434 | * update. @fs.@location specifies the index to use and must not be | ||
435 | * ignored. | ||
436 | * | ||
437 | * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the index of an | ||
438 | * existing filter rule on entry. | ||
439 | * | ||
440 | * Implementation of indexed classification rules generally requires a | ||
441 | * TCAM. | ||
442 | */ | ||
377 | struct ethtool_rxnfc { | 443 | struct ethtool_rxnfc { |
378 | __u32 cmd; | 444 | __u32 cmd; |
379 | __u32 flow_type; | 445 | __u32 flow_type; |
380 | /* The rx flow hash value or the rule DB size */ | ||
381 | __u64 data; | 446 | __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; | 447 | struct ethtool_rx_flow_spec fs; |
385 | __u32 rule_cnt; | 448 | __u32 rule_cnt; |
386 | __u32 rule_locs[0]; | 449 | __u32 rule_locs[0]; |
387 | }; | 450 | }; |
388 | 451 | ||
452 | /** | ||
453 | * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection | ||
454 | * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR | ||
455 | * @size: On entry, the array size of the user buffer. On return from | ||
456 | * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. | ||
457 | * @ring_index: RX ring/queue index for each hash value | ||
458 | */ | ||
389 | struct ethtool_rxfh_indir { | 459 | struct ethtool_rxfh_indir { |
390 | __u32 cmd; | 460 | __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; | 461 | __u32 size; |
395 | __u32 ring_index[0]; /* ring/queue index for each hash value */ | 462 | __u32 ring_index[0]; |
396 | }; | 463 | }; |
397 | 464 | ||
465 | /** | ||
466 | * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter | ||
467 | * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW | ||
468 | * @h_u: Flow field values to match (dependent on @flow_type) | ||
469 | * @m_u: Masks for flow field value bits to be ignored | ||
470 | * @vlan_tag: VLAN tag to match | ||
471 | * @vlan_tag_mask: Mask for VLAN tag bits to be ignored | ||
472 | * @data: Driver-dependent data to match | ||
473 | * @data_mask: Mask for driver-dependent data bits to be ignored | ||
474 | * @action: RX ring/queue index to deliver to (non-negative) or other action | ||
475 | * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) | ||
476 | * | ||
477 | * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where | ||
478 | * a field value and mask are both zero this is treated as if all mask | ||
479 | * bits are set i.e. the field is ignored. | ||
480 | */ | ||
398 | struct ethtool_rx_ntuple_flow_spec { | 481 | struct ethtool_rx_ntuple_flow_spec { |
399 | __u32 flow_type; | 482 | __u32 flow_type; |
400 | union { | 483 | union { |
@@ -403,22 +486,26 @@ struct ethtool_rx_ntuple_flow_spec { | |||
403 | struct ethtool_tcpip4_spec sctp_ip4_spec; | 486 | struct ethtool_tcpip4_spec sctp_ip4_spec; |
404 | struct ethtool_ah_espip4_spec ah_ip4_spec; | 487 | struct ethtool_ah_espip4_spec ah_ip4_spec; |
405 | struct ethtool_ah_espip4_spec esp_ip4_spec; | 488 | struct ethtool_ah_espip4_spec esp_ip4_spec; |
406 | struct ethtool_rawip4_spec raw_ip4_spec; | ||
407 | struct ethtool_ether_spec ether_spec; | ||
408 | struct ethtool_usrip4_spec usr_ip4_spec; | 489 | struct ethtool_usrip4_spec usr_ip4_spec; |
409 | __u8 hdata[64]; | 490 | struct ethhdr ether_spec; |
410 | } h_u, m_u; /* entry, mask */ | 491 | __u8 hdata[72]; |
492 | } h_u, m_u; | ||
411 | 493 | ||
412 | __u16 vlan_tag; | 494 | __u16 vlan_tag; |
413 | __u16 vlan_tag_mask; | 495 | __u16 vlan_tag_mask; |
414 | __u64 data; /* user-defined flow spec data */ | 496 | __u64 data; |
415 | __u64 data_mask; /* user-defined flow spec mask */ | 497 | __u64 data_mask; |
416 | 498 | ||
417 | /* signed to distinguish between queue and actions (DROP) */ | ||
418 | __s32 action; | 499 | __s32 action; |
419 | #define ETHTOOL_RXNTUPLE_ACTION_DROP -1 | 500 | #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ |
501 | #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ | ||
420 | }; | 502 | }; |
421 | 503 | ||
504 | /** | ||
505 | * struct ethtool_rx_ntuple - command to set or clear RX flow filter | ||
506 | * @cmd: Command number - %ETHTOOL_SRXNTUPLE | ||
507 | * @fs: Flow filter specification | ||
508 | */ | ||
422 | struct ethtool_rx_ntuple { | 509 | struct ethtool_rx_ntuple { |
423 | __u32 cmd; | 510 | __u32 cmd; |
424 | struct ethtool_rx_ntuple_flow_spec fs; | 511 | struct ethtool_rx_ntuple_flow_spec fs; |
@@ -759,22 +846,23 @@ struct ethtool_ops { | |||
759 | #define WAKE_MAGIC (1 << 5) | 846 | #define WAKE_MAGIC (1 << 5) |
760 | #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ | 847 | #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ |
761 | 848 | ||
762 | /* L3-L4 network traffic flow types */ | 849 | /* L2-L4 network traffic flow types */ |
763 | #define TCP_V4_FLOW 0x01 | 850 | #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ |
764 | #define UDP_V4_FLOW 0x02 | 851 | #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ |
765 | #define SCTP_V4_FLOW 0x03 | 852 | #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ |
766 | #define AH_ESP_V4_FLOW 0x04 | 853 | #define AH_ESP_V4_FLOW 0x04 /* hash only */ |
767 | #define TCP_V6_FLOW 0x05 | 854 | #define TCP_V6_FLOW 0x05 /* hash only */ |
768 | #define UDP_V6_FLOW 0x06 | 855 | #define UDP_V6_FLOW 0x06 /* hash only */ |
769 | #define SCTP_V6_FLOW 0x07 | 856 | #define SCTP_V6_FLOW 0x07 /* hash only */ |
770 | #define AH_ESP_V6_FLOW 0x08 | 857 | #define AH_ESP_V6_FLOW 0x08 /* hash only */ |
771 | #define AH_V4_FLOW 0x09 | 858 | #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ |
772 | #define ESP_V4_FLOW 0x0a | 859 | #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ |
773 | #define AH_V6_FLOW 0x0b | 860 | #define AH_V6_FLOW 0x0b /* hash only */ |
774 | #define ESP_V6_FLOW 0x0c | 861 | #define ESP_V6_FLOW 0x0c /* hash only */ |
775 | #define IP_USER_FLOW 0x0d | 862 | #define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ |
776 | #define IPV4_FLOW 0x10 | 863 | #define IPV4_FLOW 0x10 /* hash only */ |
777 | #define IPV6_FLOW 0x11 | 864 | #define IPV6_FLOW 0x11 /* hash only */ |
865 | #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ | ||
778 | 866 | ||
779 | /* L3-L4 network traffic flow hash options */ | 867 | /* L3-L4 network traffic flow hash options */ |
780 | #define RXH_L2DA (1 << 1) | 868 | #define RXH_L2DA (1 << 1) |