Skip to content

Commit

Permalink
Staging: batman-adv: Prepare vis packets directly inside a skb
Browse files Browse the repository at this point in the history
The vis information structure is used in a way that it can be transfered
directly as packet. It still had to be copied into a skb because of an
extra buffer used for the actual preparation of the data. This is
unnecessary and can be replaced by a simple clone instead of an full
copy before each send.

This makes also the send_raw_packet function obsolete.

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Sep 5, 2010
1 parent b706007 commit b411d49
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 96 deletions.
2 changes: 0 additions & 2 deletions drivers/staging/batman-adv/TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
* Save/cache packets direktly as skb instead of using a normal memory region
and copying it in a skb using send_raw_packet and similar functions
* Request a new review
* Process the comments from the review
* Move into mainline proper
Expand Down
17 changes: 0 additions & 17 deletions drivers/staging/batman-adv/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,6 @@ int send_skb_packet(struct sk_buff *skb,
return NET_XMIT_DROP;
}

/* sends a raw packet. */
void send_raw_packet(unsigned char *pack_buff, int pack_buff_len,
struct batman_if *batman_if, uint8_t *dst_addr)
{
struct sk_buff *skb;
char *data;

skb = dev_alloc_skb(pack_buff_len + sizeof(struct ethhdr));
if (!skb)
return;
data = skb_put(skb, pack_buff_len + sizeof(struct ethhdr));
memcpy(data + sizeof(struct ethhdr), pack_buff, pack_buff_len);
/* pull back to the batman "network header" */
skb_pull(skb, sizeof(struct ethhdr));
send_skb_packet(skb, batman_if, dst_addr);
}

/* Send a packet to a given interface */
static void send_packet_to_if(struct forw_packet *forw_packet,
struct batman_if *batman_if)
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/batman-adv/send.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
int send_skb_packet(struct sk_buff *skb,
struct batman_if *batman_if,
uint8_t *dst_addr);
void send_raw_packet(unsigned char *pack_buff, int pack_buff_len,
struct batman_if *batman_if, uint8_t *dst_addr);
void schedule_own_packet(struct batman_if *batman_if);
void schedule_forward_packet(struct orig_node *orig_node,
struct ethhdr *ethhdr,
Expand Down
Loading

0 comments on commit b411d49

Please sign in to comment.