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