mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 13:57:40 +07:00
Here are some batman-adv bugfixes:
- Fix head/tailroom issues for fragments, by Sven Eckelmann (3 patches) -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEE1ilQI7G+y+fdhnrfoSvjmEKSnqEFAl/BORsWHHN3QHNpbW9u d3VuZGVybGljaC5kZQAKCRChK+OYQpKeoX+AD/wJYmiGL8beD3eCBQdTjmvJNRbZ MIlzse2LsiSk/4G/UbrEr11M4pc6gFDghH/VXs2MxD2hd6qJsJH7ulAQKMPzTEqD WhwlyJ08O9HIivaN2Ri1ibwmLIDAYlvR2bsWu95weI/hDdE5ups/kIvBudM8b+fC HKQ/e9wGaiB+zUUobvl6bP0Av6u3xPNTHFkXgGTo1shgLISAYFsmEoYQ3yZYrYKy P9ckwLoJwMD6AODMRvWVmW4dzi5QSBWN/84XgQSoqdlZeNklIcTY2P5XWdePo7cv wTnSxm4gJwdU7i8dBXLbtOYzmavzq0JkQHnRcFcKm6RWMbaeNNwfYUwMLp4h4ZtG Mjh0qt4IyuRb5Tf7jkoZ9UR4fIftpuMNMMvE37Cfr7wUZKWtVbG9jHyydU2MZ678 vAF5NigYHa88i+MSdbXq8fPflmhddiHsN05nzI3olzX7tBFWNDf+71P82Gm4zKuM YC4ZlZH7Rrb79C13CJm5xKN0MI5TYGDYJeFLV4Km7hZ9H9EyDJcsuSFPgV0R0hg5 Y5rWIWRrK/lU1aSXPSEuyL1P+tbH5z5xeYxdPUz2WroqNTyre6ycXy+wuoyCw5Ij t91wqD8pNC1/3nynBbI2kcLeGFPjDTEfWYcYN7OE3Ts6AXr3fs8x1XUcUsseAZ1P oxaUxzzfCcDno3abtg== =mORx -----END PGP SIGNATURE----- Merge tag 'batadv-net-pullrequest-20201127' of git://git.open-mesh.org/linux-merge Simon Wunderlich says: ==================== Here are some batman-adv bugfixes: - Fix head/tailroom issues for fragments, by Sven Eckelmann (3 patches) * tag 'batadv-net-pullrequest-20201127' of git://git.open-mesh.org/linux-merge: batman-adv: Don't always reallocate the fragmentation skb head batman-adv: Reserve needed_*room for fragments batman-adv: Consider fragmentation for needed_headroom ==================== Link: https://lore.kernel.org/r/20201127173849.19208-1-sw@simonwunderlich.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
28d35ad083
@ -391,6 +391,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* batadv_frag_create() - create a fragment from skb
|
* batadv_frag_create() - create a fragment from skb
|
||||||
|
* @net_dev: outgoing device for fragment
|
||||||
* @skb: skb to create fragment from
|
* @skb: skb to create fragment from
|
||||||
* @frag_head: header to use in new fragment
|
* @frag_head: header to use in new fragment
|
||||||
* @fragment_size: size of new fragment
|
* @fragment_size: size of new fragment
|
||||||
@ -401,22 +402,25 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
|
|||||||
*
|
*
|
||||||
* Return: the new fragment, NULL on error.
|
* Return: the new fragment, NULL on error.
|
||||||
*/
|
*/
|
||||||
static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
|
static struct sk_buff *batadv_frag_create(struct net_device *net_dev,
|
||||||
|
struct sk_buff *skb,
|
||||||
struct batadv_frag_packet *frag_head,
|
struct batadv_frag_packet *frag_head,
|
||||||
unsigned int fragment_size)
|
unsigned int fragment_size)
|
||||||
{
|
{
|
||||||
|
unsigned int ll_reserved = LL_RESERVED_SPACE(net_dev);
|
||||||
|
unsigned int tailroom = net_dev->needed_tailroom;
|
||||||
struct sk_buff *skb_fragment;
|
struct sk_buff *skb_fragment;
|
||||||
unsigned int header_size = sizeof(*frag_head);
|
unsigned int header_size = sizeof(*frag_head);
|
||||||
unsigned int mtu = fragment_size + header_size;
|
unsigned int mtu = fragment_size + header_size;
|
||||||
|
|
||||||
skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN);
|
skb_fragment = dev_alloc_skb(ll_reserved + mtu + tailroom);
|
||||||
if (!skb_fragment)
|
if (!skb_fragment)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
skb_fragment->priority = skb->priority;
|
skb_fragment->priority = skb->priority;
|
||||||
|
|
||||||
/* Eat the last mtu-bytes of the skb */
|
/* Eat the last mtu-bytes of the skb */
|
||||||
skb_reserve(skb_fragment, header_size + ETH_HLEN);
|
skb_reserve(skb_fragment, ll_reserved + header_size);
|
||||||
skb_split(skb, skb_fragment, skb->len - fragment_size);
|
skb_split(skb, skb_fragment, skb->len - fragment_size);
|
||||||
|
|
||||||
/* Add the header */
|
/* Add the header */
|
||||||
@ -439,11 +443,12 @@ int batadv_frag_send_packet(struct sk_buff *skb,
|
|||||||
struct batadv_orig_node *orig_node,
|
struct batadv_orig_node *orig_node,
|
||||||
struct batadv_neigh_node *neigh_node)
|
struct batadv_neigh_node *neigh_node)
|
||||||
{
|
{
|
||||||
|
struct net_device *net_dev = neigh_node->if_incoming->net_dev;
|
||||||
struct batadv_priv *bat_priv;
|
struct batadv_priv *bat_priv;
|
||||||
struct batadv_hard_iface *primary_if = NULL;
|
struct batadv_hard_iface *primary_if = NULL;
|
||||||
struct batadv_frag_packet frag_header;
|
struct batadv_frag_packet frag_header;
|
||||||
struct sk_buff *skb_fragment;
|
struct sk_buff *skb_fragment;
|
||||||
unsigned int mtu = neigh_node->if_incoming->net_dev->mtu;
|
unsigned int mtu = net_dev->mtu;
|
||||||
unsigned int header_size = sizeof(frag_header);
|
unsigned int header_size = sizeof(frag_header);
|
||||||
unsigned int max_fragment_size, num_fragments;
|
unsigned int max_fragment_size, num_fragments;
|
||||||
int ret;
|
int ret;
|
||||||
@ -503,7 +508,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
|
|||||||
goto put_primary_if;
|
goto put_primary_if;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb_fragment = batadv_frag_create(skb, &frag_header,
|
skb_fragment = batadv_frag_create(net_dev, skb, &frag_header,
|
||||||
max_fragment_size);
|
max_fragment_size);
|
||||||
if (!skb_fragment) {
|
if (!skb_fragment) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@ -522,13 +527,14 @@ int batadv_frag_send_packet(struct sk_buff *skb,
|
|||||||
frag_header.no++;
|
frag_header.no++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make room for the fragment header. */
|
/* make sure that there is at least enough head for the fragmentation
|
||||||
if (batadv_skb_head_push(skb, header_size) < 0 ||
|
* and ethernet headers
|
||||||
pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) {
|
*/
|
||||||
ret = -ENOMEM;
|
ret = skb_cow_head(skb, ETH_HLEN + header_size);
|
||||||
|
if (ret < 0)
|
||||||
goto put_primary_if;
|
goto put_primary_if;
|
||||||
}
|
|
||||||
|
|
||||||
|
skb_push(skb, header_size);
|
||||||
memcpy(skb->data, &frag_header, header_size);
|
memcpy(skb->data, &frag_header, header_size);
|
||||||
|
|
||||||
/* Send the last fragment */
|
/* Send the last fragment */
|
||||||
|
@ -554,6 +554,9 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
|
|||||||
needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN);
|
needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN);
|
||||||
needed_headroom += batadv_max_header_len();
|
needed_headroom += batadv_max_header_len();
|
||||||
|
|
||||||
|
/* fragmentation headers don't strip the unicast/... header */
|
||||||
|
needed_headroom += sizeof(struct batadv_frag_packet);
|
||||||
|
|
||||||
soft_iface->needed_headroom = needed_headroom;
|
soft_iface->needed_headroom = needed_headroom;
|
||||||
soft_iface->needed_tailroom = lower_tailroom;
|
soft_iface->needed_tailroom = lower_tailroom;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user