Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219752
b: refs/heads/master
c: 99eed28
h: refs/heads/master
v: v3
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Sep 5, 2010
1 parent 7051f0c commit 1491bd5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15cf5523d2e42f755b3b1d8ea0fa601ffcf8b9e7
refs/heads/master: 99eed2842c4f67d1b9267173221441a48cd634a1
2 changes: 1 addition & 1 deletion trunk/drivers/staging/batman-adv/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int send_skb_packet(struct sk_buff *skb,
}

/* push to the ethernet header. */
if (my_skb_push(skb, sizeof(struct ethhdr)) < 0)
if (my_skb_head_push(skb, sizeof(struct ethhdr)) < 0)
goto send_skb_err;

skb_reset_mac_header(skb);
Expand Down
26 changes: 14 additions & 12 deletions trunk/drivers/staging/batman-adv/soft-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

static uint32_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid
* broadcast storms */
static int32_t skb_packets;
static int32_t skb_bad_packets;

unsigned char main_if_addr[ETH_ALEN];
static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
Expand All @@ -59,18 +57,22 @@ void set_main_if_addr(uint8_t *addr)
memcpy(main_if_addr, addr, ETH_ALEN);
}

int my_skb_push(struct sk_buff *skb, unsigned int len)
int my_skb_head_push(struct sk_buff *skb, unsigned int len)
{
int result = 0;
int result;

skb_packets++;
if (skb_headroom(skb) < len) {
skb_bad_packets++;
result = pskb_expand_head(skb, len, 0, GFP_ATOMIC);
/**
* TODO: We must check if we can release all references to non-payload
* data using skb_header_release in our skbs to allow skb_cow_header to
* work optimally. This means that those skbs are not allowed to read
* or write any data which is before the current position of skb->data
* after that call and thus allow other skbs with the same data buffer
* to write freely in that area.
*/
result = skb_cow_head(skb, len);

if (result < 0)
return result;
}
if (result < 0)
return result;

skb_push(skb, len);
return 0;
Expand Down Expand Up @@ -140,7 +142,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *dev)
/* ethernet packet should be broadcasted */
if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest)) {

if (my_skb_push(skb, sizeof(struct bcast_packet)) < 0)
if (my_skb_head_push(skb, sizeof(struct bcast_packet)) < 0)
goto dropped;

bcast_packet = (struct bcast_packet *)skb->data;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/batman-adv/soft-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void set_main_if_addr(uint8_t *addr);
void interface_setup(struct net_device *dev);
int interface_tx(struct sk_buff *skb, struct net_device *dev);
void interface_rx(struct sk_buff *skb, int hdr_size);
int my_skb_push(struct sk_buff *skb, unsigned int len);
int my_skb_head_push(struct sk_buff *skb, unsigned int len);

extern unsigned char main_if_addr[];

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/staging/batman-adv/unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ static int unicast_send_frag_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
frag_skb = dev_alloc_skb(data_len - (data_len / 2) + hdr_len);
skb_split(skb, frag_skb, data_len / 2);

if (my_skb_push(frag_skb, hdr_len) < 0 ||
my_skb_push(skb, hdr_len) < 0)
if (my_skb_head_push(frag_skb, hdr_len) < 0 ||
my_skb_head_push(skb, hdr_len) < 0)
goto drop_frag;

ucast_frag1 = (struct unicast_frag_packet *)skb->data;
Expand Down Expand Up @@ -240,7 +240,7 @@ int unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
return unicast_send_frag_skb(skb, bat_priv, batman_if,
dstaddr, orig_node);

if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0)
if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0)
goto dropped;

unicast_packet = (struct unicast_packet *)skb->data;
Expand Down

0 comments on commit 1491bd5

Please sign in to comment.