diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9bde9558b596..27914672602d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -866,11 +866,15 @@ struct netdev_xdp { | |||
866 | * of useless work if you return NETDEV_TX_BUSY. | 866 | * of useless work if you return NETDEV_TX_BUSY. |
867 | * Required; cannot be NULL. | 867 | * Required; cannot be NULL. |
868 | * | 868 | * |
869 | * netdev_features_t (*ndo_fix_features)(struct net_device *dev, | 869 | * netdev_features_t (*ndo_features_check)(struct sk_buff *skb, |
870 | * netdev_features_t features); | 870 | * struct net_device *dev |
871 | * Adjusts the requested feature flags according to device-specific | 871 | * netdev_features_t features); |
872 | * constraints, and returns the resulting flags. Must not modify | 872 | * Called by core transmit path to determine if device is capable of |
873 | * the device state. | 873 | * performing offload operations on a given packet. This is to give |
874 | * the device an opportunity to implement any restrictions that cannot | ||
875 | * be otherwise expressed by feature flags. The check is called with | ||
876 | * the set of features that the stack has calculated and it returns | ||
877 | * those the driver believes to be appropriate. | ||
874 | * | 878 | * |
875 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, | 879 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, |
876 | * void *accel_priv, select_queue_fallback_t fallback); | 880 | * void *accel_priv, select_queue_fallback_t fallback); |
@@ -1028,6 +1032,12 @@ struct netdev_xdp { | |||
1028 | * Called to release previously enslaved netdev. | 1032 | * Called to release previously enslaved netdev. |
1029 | * | 1033 | * |
1030 | * Feature/offload setting functions. | 1034 | * Feature/offload setting functions. |
1035 | * netdev_features_t (*ndo_fix_features)(struct net_device *dev, | ||
1036 | * netdev_features_t features); | ||
1037 | * Adjusts the requested feature flags according to device-specific | ||
1038 | * constraints, and returns the resulting flags. Must not modify | ||
1039 | * the device state. | ||
1040 | * | ||
1031 | * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); | 1041 | * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); |
1032 | * Called to update device configuration to new features. Passed | 1042 | * Called to update device configuration to new features. Passed |
1033 | * feature set might be less than what was returned by ndo_fix_features()). | 1043 | * feature set might be less than what was returned by ndo_fix_features()). |
@@ -1100,15 +1110,6 @@ struct netdev_xdp { | |||
1100 | * Callback to use for xmit over the accelerated station. This | 1110 | * Callback to use for xmit over the accelerated station. This |
1101 | * is used in place of ndo_start_xmit on accelerated net | 1111 | * is used in place of ndo_start_xmit on accelerated net |
1102 | * devices. | 1112 | * devices. |
1103 | * netdev_features_t (*ndo_features_check)(struct sk_buff *skb, | ||
1104 | * struct net_device *dev | ||
1105 | * netdev_features_t features); | ||
1106 | * Called by core transmit path to determine if device is capable of | ||
1107 | * performing offload operations on a given packet. This is to give | ||
1108 | * the device an opportunity to implement any restrictions that cannot | ||
1109 | * be otherwise expressed by feature flags. The check is called with | ||
1110 | * the set of features that the stack has calculated and it returns | ||
1111 | * those the driver believes to be appropriate. | ||
1112 | * int (*ndo_set_tx_maxrate)(struct net_device *dev, | 1113 | * int (*ndo_set_tx_maxrate)(struct net_device *dev, |
1113 | * int queue_index, u32 maxrate); | 1114 | * int queue_index, u32 maxrate); |
1114 | * Called when a user wants to set a max-rate limitation of specific | 1115 | * Called when a user wants to set a max-rate limitation of specific |
@@ -1510,6 +1511,7 @@ enum netdev_priv_flags { | |||
1510 | * @max_mtu: Interface Maximum MTU value | 1511 | * @max_mtu: Interface Maximum MTU value |
1511 | * @type: Interface hardware type | 1512 | * @type: Interface hardware type |
1512 | * @hard_header_len: Maximum hardware header length. | 1513 | * @hard_header_len: Maximum hardware header length. |
1514 | * @min_header_len: Minimum hardware header length | ||
1513 | * | 1515 | * |
1514 | * @needed_headroom: Extra headroom the hardware may need, but not in all | 1516 | * @needed_headroom: Extra headroom the hardware may need, but not in all |
1515 | * cases can this be guaranteed | 1517 | * cases can this be guaranteed |
@@ -1727,6 +1729,7 @@ struct net_device { | |||
1727 | unsigned int max_mtu; | 1729 | unsigned int max_mtu; |
1728 | unsigned short type; | 1730 | unsigned short type; |
1729 | unsigned short hard_header_len; | 1731 | unsigned short hard_header_len; |
1732 | unsigned short min_header_len; | ||
1730 | 1733 | ||
1731 | unsigned short needed_headroom; | 1734 | unsigned short needed_headroom; |
1732 | unsigned short needed_tailroom; | 1735 | unsigned short needed_tailroom; |
@@ -2693,6 +2696,8 @@ static inline bool dev_validate_header(const struct net_device *dev, | |||
2693 | { | 2696 | { |
2694 | if (likely(len >= dev->hard_header_len)) | 2697 | if (likely(len >= dev->hard_header_len)) |
2695 | return true; | 2698 | return true; |
2699 | if (len < dev->min_header_len) | ||
2700 | return false; | ||
2696 | 2701 | ||
2697 | if (capable(CAP_SYS_RAWIO)) { | 2702 | if (capable(CAP_SYS_RAWIO)) { |
2698 | memset(ll_header + len, 0, dev->hard_header_len - len); | 2703 | memset(ll_header + len, 0, dev->hard_header_len - len); |