batman-adv: Drop compat-hack for nla_put_u64_64bit
nla_put_u64_64bit is already defined by the mac80211's backports and doesn't have to be redefined in the compat-hacks.h. Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
89bc1bc1a1
commit
3f0a7c4880
1 changed files with 0 additions and 93 deletions
|
@ -105,99 +105,6 @@ batadv_ethtool_get_link_ksettings(struct net_device *dev,
|
|||
#endif /* < KERNEL_VERSION(4, 6, 0) */
|
||||
|
||||
|
||||
#include_next <linux/netlink.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
|
||||
|
||||
#include_next <net/netlink.h>
|
||||
|
||||
static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb);
|
||||
|
||||
static inline int batadv_nla_align_64bit(struct sk_buff *skb, int padattr)
|
||||
{
|
||||
if (batadv_nla_need_padding_for_64bit(skb) &&
|
||||
!nla_reserve(skb, padattr, 0))
|
||||
return -EMSGSIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct nlattr *batadv__nla_reserve_64bit(struct sk_buff *skb,
|
||||
int attrtype,
|
||||
int attrlen, int padattr)
|
||||
{
|
||||
if (batadv_nla_need_padding_for_64bit(skb))
|
||||
batadv_nla_align_64bit(skb, padattr);
|
||||
|
||||
return __nla_reserve(skb, attrtype, attrlen);
|
||||
}
|
||||
|
||||
static inline void batadv__nla_put_64bit(struct sk_buff *skb, int attrtype,
|
||||
int attrlen, const void *data,
|
||||
int padattr)
|
||||
{
|
||||
struct nlattr *nla;
|
||||
|
||||
nla = batadv__nla_reserve_64bit(skb, attrtype, attrlen, padattr);
|
||||
memcpy(nla_data(nla), data, attrlen);
|
||||
}
|
||||
|
||||
static inline bool batadv_nla_need_padding_for_64bit(struct sk_buff *skb)
|
||||
{
|
||||
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
/* The nlattr header is 4 bytes in size, that's why we test
|
||||
* if the skb->data _is_ aligned. A NOP attribute, plus
|
||||
* nlattr header for next attribute, will make nla_data()
|
||||
* 8-byte aligned.
|
||||
*/
|
||||
if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int batadv_nla_total_size_64bit(int payload)
|
||||
{
|
||||
return NLA_ALIGN(nla_attr_size(payload))
|
||||
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
+ NLA_ALIGN(nla_attr_size(0))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
static inline int batadv_nla_put_64bit(struct sk_buff *skb, int attrtype,
|
||||
int attrlen, const void *data,
|
||||
int padattr)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (batadv_nla_need_padding_for_64bit(skb))
|
||||
len = batadv_nla_total_size_64bit(attrlen);
|
||||
else
|
||||
len = nla_total_size(attrlen);
|
||||
if (unlikely(skb_tailroom(skb) < len))
|
||||
return -EMSGSIZE;
|
||||
|
||||
batadv__nla_put_64bit(skb, attrtype, attrlen, data, padattr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef nla_put_u64_64bit
|
||||
#undef nla_put_u64_64bit
|
||||
#endif
|
||||
|
||||
#define nla_put_u64_64bit(_skb, _attrtype, _value, _padattr) \
|
||||
batadv_nla_put_u64_64bit(_skb, _attrtype, _value, _padattr)
|
||||
static inline int batadv_nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
|
||||
u64 value, int padattr)
|
||||
{
|
||||
return batadv_nla_put_64bit(skb, attrtype, sizeof(u64), &value,
|
||||
padattr);
|
||||
}
|
||||
|
||||
#endif /* < KERNEL_VERSION(4, 7, 0) */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
|
||||
|
||||
#include_next <linux/cache.h>
|
||||
|
|
Loading…
Reference in a new issue