diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/key-type.h | 22 | ||||
| -rw-r--r-- | include/linux/netdev_features.h | 24 | ||||
| -rw-r--r-- | include/linux/skbuff.h | 8 | ||||
| -rw-r--r-- | include/linux/virtio_net.h | 9 | 
4 files changed, 44 insertions, 19 deletions
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index bc9af551fc83..e49d1de0614e 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h @@ -21,15 +21,6 @@ struct kernel_pkey_query;  struct kernel_pkey_params;  /* - * key under-construction record - * - passed to the request_key actor if supplied - */ -struct key_construction { -	struct key	*key;	/* key being constructed */ -	struct key	*authkey;/* authorisation for key being constructed */ -}; - -/*   * Pre-parsed payload, used by key add, update and instantiate.   *   * This struct will be cleared and data and datalen will be set with the data @@ -50,8 +41,7 @@ struct key_preparsed_payload {  	time64_t	expiry;		/* Expiry time of key */  } __randomize_layout; -typedef int (*request_key_actor_t)(struct key_construction *key, -				   const char *op, void *aux); +typedef int (*request_key_actor_t)(struct key *auth_key, void *aux);  /*   * Preparsed matching criterion. @@ -181,20 +171,20 @@ extern int key_instantiate_and_link(struct key *key,  				    const void *data,  				    size_t datalen,  				    struct key *keyring, -				    struct key *instkey); +				    struct key *authkey);  extern int key_reject_and_link(struct key *key,  			       unsigned timeout,  			       unsigned error,  			       struct key *keyring, -			       struct key *instkey); -extern void complete_request_key(struct key_construction *cons, int error); +			       struct key *authkey); +extern void complete_request_key(struct key *authkey, int error);  static inline int key_negate_and_link(struct key *key,  				      unsigned timeout,  				      struct key *keyring, -				      struct key *instkey) +				      struct key *authkey)  { -	return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); +	return key_reject_and_link(key, timeout, ENOKEY, keyring, authkey);  }  extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 2b2a6dce1630..4c76fe2c8488 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -11,6 +11,8 @@  #define _LINUX_NETDEV_FEATURES_H  #include <linux/types.h> +#include <linux/bitops.h> +#include <asm/byteorder.h>  typedef u64 netdev_features_t; @@ -154,8 +156,26 @@ enum {  #define NETIF_F_HW_TLS_TX	__NETIF_F(HW_TLS_TX)  #define NETIF_F_HW_TLS_RX	__NETIF_F(HW_TLS_RX) -#define for_each_netdev_feature(mask_addr, bit)	\ -	for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) +/* Finds the next feature with the highest number of the range of start till 0. + */ +static inline int find_next_netdev_feature(u64 feature, unsigned long start) +{ +	/* like BITMAP_LAST_WORD_MASK() for u64 +	 * this sets the most significant 64 - start to 0. +	 */ +	feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1)); + +	return fls64(feature) - 1; +} + +/* This goes for the MSB to the LSB through the set feature bits, + * mask_addr should be a u64 and bit an int + */ +#define for_each_netdev_feature(mask_addr, bit)				\ +	for ((bit) = find_next_netdev_feature((mask_addr),		\ +					      NETDEV_FEATURE_COUNT);	\ +	     (bit) >= 0;						\ +	     (bit) = find_next_netdev_feature((mask_addr), (bit) - 1))  /* Features valid for ethtool to change */  /* = all defined minus driver/device-class-related */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 95d25b010a25..bdb9563c64a0 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2434,7 +2434,7 @@ static inline void skb_probe_transport_header(struct sk_buff *skb,  	if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0))  		skb_set_transport_header(skb, keys.control.thoff); -	else +	else if (offset_hint >= 0)  		skb_set_transport_header(skb, offset_hint);  } @@ -4212,6 +4212,12 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb)  	return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP;  } +static inline bool skb_is_gso_tcp(const struct sk_buff *skb) +{ +	return skb_is_gso(skb) && +	       skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); +} +  static inline void skb_gso_reset(struct sk_buff *skb)  {  	skb_shinfo(skb)->gso_size = 0; diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index cb462f9ab7dd..71f2394abbf7 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -57,6 +57,15 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,  		if (!skb_partial_csum_set(skb, start, off))  			return -EINVAL; +	} else { +		/* gso packets without NEEDS_CSUM do not set transport_offset. +		 * probe and drop if does not match one of the above types. +		 */ +		if (gso_type) { +			skb_probe_transport_header(skb, -1); +			if (!skb_transport_header_was_set(skb)) +				return -EINVAL; +		}  	}  	if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {  | 
