diff options
Diffstat (limited to 'include/linux/ethtool.h')
| -rw-r--r-- | include/linux/ethtool.h | 129 |
1 files changed, 128 insertions, 1 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 1908929204a9..dc80d8294247 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | #ifndef _LINUX_ETHTOOL_H | 13 | #ifndef _LINUX_ETHTOOL_H |
| 14 | #define _LINUX_ETHTOOL_H | 14 | #define _LINUX_ETHTOOL_H |
| 15 | 15 | ||
| 16 | #ifdef __KERNEL__ | ||
| 17 | #include <linux/compat.h> | ||
| 18 | #endif | ||
| 16 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 17 | #include <linux/if_ether.h> | 20 | #include <linux/if_ether.h> |
| 18 | 21 | ||
| @@ -251,6 +254,7 @@ enum ethtool_stringset { | |||
| 251 | ETH_SS_STATS, | 254 | ETH_SS_STATS, |
| 252 | ETH_SS_PRIV_FLAGS, | 255 | ETH_SS_PRIV_FLAGS, |
| 253 | ETH_SS_NTUPLE_FILTERS, | 256 | ETH_SS_NTUPLE_FILTERS, |
| 257 | ETH_SS_FEATURES, | ||
| 254 | }; | 258 | }; |
| 255 | 259 | ||
| 256 | /* for passing string sets for data tagging */ | 260 | /* for passing string sets for data tagging */ |
| @@ -449,6 +453,37 @@ struct ethtool_rxnfc { | |||
| 449 | __u32 rule_locs[0]; | 453 | __u32 rule_locs[0]; |
| 450 | }; | 454 | }; |
| 451 | 455 | ||
| 456 | #ifdef __KERNEL__ | ||
| 457 | #ifdef CONFIG_COMPAT | ||
| 458 | |||
| 459 | struct compat_ethtool_rx_flow_spec { | ||
| 460 | u32 flow_type; | ||
| 461 | union { | ||
| 462 | struct ethtool_tcpip4_spec tcp_ip4_spec; | ||
| 463 | struct ethtool_tcpip4_spec udp_ip4_spec; | ||
| 464 | struct ethtool_tcpip4_spec sctp_ip4_spec; | ||
| 465 | struct ethtool_ah_espip4_spec ah_ip4_spec; | ||
| 466 | struct ethtool_ah_espip4_spec esp_ip4_spec; | ||
| 467 | struct ethtool_usrip4_spec usr_ip4_spec; | ||
| 468 | struct ethhdr ether_spec; | ||
| 469 | u8 hdata[72]; | ||
| 470 | } h_u, m_u; | ||
| 471 | compat_u64 ring_cookie; | ||
| 472 | u32 location; | ||
| 473 | }; | ||
| 474 | |||
| 475 | struct compat_ethtool_rxnfc { | ||
| 476 | u32 cmd; | ||
| 477 | u32 flow_type; | ||
| 478 | compat_u64 data; | ||
| 479 | struct compat_ethtool_rx_flow_spec fs; | ||
| 480 | u32 rule_cnt; | ||
| 481 | u32 rule_locs[0]; | ||
| 482 | }; | ||
| 483 | |||
| 484 | #endif /* CONFIG_COMPAT */ | ||
| 485 | #endif /* __KERNEL__ */ | ||
| 486 | |||
| 452 | /** | 487 | /** |
| 453 | * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection | 488 | * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection |
| 454 | * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR | 489 | * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR |
| @@ -523,10 +558,99 @@ struct ethtool_flash { | |||
| 523 | char data[ETHTOOL_FLASH_MAX_FILENAME]; | 558 | char data[ETHTOOL_FLASH_MAX_FILENAME]; |
| 524 | }; | 559 | }; |
| 525 | 560 | ||
| 561 | /* for returning and changing feature sets */ | ||
| 562 | |||
| 563 | /** | ||
| 564 | * struct ethtool_get_features_block - block with state of 32 features | ||
| 565 | * @available: mask of changeable features | ||
| 566 | * @requested: mask of features requested to be enabled if possible | ||
| 567 | * @active: mask of currently enabled features | ||
| 568 | * @never_changed: mask of features not changeable for any device | ||
| 569 | */ | ||
| 570 | struct ethtool_get_features_block { | ||
| 571 | __u32 available; | ||
| 572 | __u32 requested; | ||
| 573 | __u32 active; | ||
| 574 | __u32 never_changed; | ||
| 575 | }; | ||
| 576 | |||
| 577 | /** | ||
| 578 | * struct ethtool_gfeatures - command to get state of device's features | ||
| 579 | * @cmd: command number = %ETHTOOL_GFEATURES | ||
| 580 | * @size: in: number of elements in the features[] array; | ||
| 581 | * out: number of elements in features[] needed to hold all features | ||
| 582 | * @features: state of features | ||
| 583 | */ | ||
| 584 | struct ethtool_gfeatures { | ||
| 585 | __u32 cmd; | ||
| 586 | __u32 size; | ||
| 587 | struct ethtool_get_features_block features[0]; | ||
| 588 | }; | ||
| 589 | |||
| 590 | /** | ||
| 591 | * struct ethtool_set_features_block - block with request for 32 features | ||
| 592 | * @valid: mask of features to be changed | ||
| 593 | * @requested: values of features to be changed | ||
| 594 | */ | ||
| 595 | struct ethtool_set_features_block { | ||
| 596 | __u32 valid; | ||
| 597 | __u32 requested; | ||
| 598 | }; | ||
| 599 | |||
| 600 | /** | ||
| 601 | * struct ethtool_sfeatures - command to request change in device's features | ||
| 602 | * @cmd: command number = %ETHTOOL_SFEATURES | ||
| 603 | * @size: array size of the features[] array | ||
| 604 | * @features: feature change masks | ||
| 605 | */ | ||
| 606 | struct ethtool_sfeatures { | ||
| 607 | __u32 cmd; | ||
| 608 | __u32 size; | ||
| 609 | struct ethtool_set_features_block features[0]; | ||
| 610 | }; | ||
| 611 | |||
| 612 | /* | ||
| 613 | * %ETHTOOL_SFEATURES changes features present in features[].valid to the | ||
| 614 | * values of corresponding bits in features[].requested. Bits in .requested | ||
| 615 | * not set in .valid or not changeable are ignored. | ||
| 616 | * | ||
| 617 | * Returns %EINVAL when .valid contains undefined or never-changeable bits | ||
| 618 | * or size is not equal to required number of features words (32-bit blocks). | ||
| 619 | * Returns >= 0 if request was completed; bits set in the value mean: | ||
| 620 | * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not | ||
| 621 | * changeable (not present in %ETHTOOL_GFEATURES' features[].available) | ||
| 622 | * those bits were ignored. | ||
| 623 | * %ETHTOOL_F_WISH - some or all changes requested were recorded but the | ||
| 624 | * resulting state of bits masked by .valid is not equal to .requested. | ||
| 625 | * Probably there are other device-specific constraints on some features | ||
| 626 | * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered | ||
| 627 | * here as though ignored bits were cleared. | ||
| 628 | * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling | ||
| 629 | * compatibility functions. Requested offload state cannot be properly | ||
| 630 | * managed by kernel. | ||
| 631 | * | ||
| 632 | * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of | ||
| 633 | * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands | ||
| 634 | * for ETH_SS_FEATURES string set. First entry in the table corresponds to least | ||
| 635 | * significant bit in features[0] fields. Empty strings mark undefined features. | ||
| 636 | */ | ||
| 637 | enum ethtool_sfeatures_retval_bits { | ||
| 638 | ETHTOOL_F_UNSUPPORTED__BIT, | ||
| 639 | ETHTOOL_F_WISH__BIT, | ||
| 640 | ETHTOOL_F_COMPAT__BIT, | ||
| 641 | }; | ||
| 642 | |||
| 643 | #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) | ||
| 644 | #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) | ||
| 645 | #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) | ||
| 646 | |||
| 526 | #ifdef __KERNEL__ | 647 | #ifdef __KERNEL__ |
| 527 | 648 | ||
| 528 | #include <linux/rculist.h> | 649 | #include <linux/rculist.h> |
| 529 | 650 | ||
| 651 | /* needed by dev_disable_lro() */ | ||
| 652 | extern int __ethtool_set_flags(struct net_device *dev, u32 flags); | ||
| 653 | |||
| 530 | struct ethtool_rx_ntuple_flow_spec_container { | 654 | struct ethtool_rx_ntuple_flow_spec_container { |
| 531 | struct ethtool_rx_ntuple_flow_spec fs; | 655 | struct ethtool_rx_ntuple_flow_spec fs; |
| 532 | struct list_head list; | 656 | struct list_head list; |
| @@ -543,7 +667,6 @@ struct net_device; | |||
| 543 | 667 | ||
| 544 | /* Some generic methods drivers may use in their ethtool_ops */ | 668 | /* Some generic methods drivers may use in their ethtool_ops */ |
| 545 | u32 ethtool_op_get_link(struct net_device *dev); | 669 | u32 ethtool_op_get_link(struct net_device *dev); |
| 546 | u32 ethtool_op_get_rx_csum(struct net_device *dev); | ||
| 547 | u32 ethtool_op_get_tx_csum(struct net_device *dev); | 670 | u32 ethtool_op_get_tx_csum(struct net_device *dev); |
| 548 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); | 671 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); |
| 549 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); | 672 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); |
| @@ -557,6 +680,7 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data); | |||
| 557 | u32 ethtool_op_get_flags(struct net_device *dev); | 680 | u32 ethtool_op_get_flags(struct net_device *dev); |
| 558 | int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); | 681 | int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); |
| 559 | void ethtool_ntuple_flush(struct net_device *dev); | 682 | void ethtool_ntuple_flush(struct net_device *dev); |
| 683 | bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported); | ||
| 560 | 684 | ||
| 561 | /** | 685 | /** |
| 562 | * ðtool_ops - Alter and report network device settings | 686 | * ðtool_ops - Alter and report network device settings |
| @@ -744,6 +868,9 @@ struct ethtool_ops { | |||
| 744 | #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ | 868 | #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ |
| 745 | #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ | 869 | #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ |
| 746 | 870 | ||
| 871 | #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ | ||
| 872 | #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ | ||
| 873 | |||
| 747 | /* compatibility with older code */ | 874 | /* compatibility with older code */ |
| 748 | #define SPARC_ETH_GSET ETHTOOL_GSET | 875 | #define SPARC_ETH_GSET ETHTOOL_GSET |
| 749 | #define SPARC_ETH_SSET ETHTOOL_SSET | 876 | #define SPARC_ETH_SSET ETHTOOL_SSET |
