Commit b411d498 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Greg Kroah-Hartman

Staging: batman-adv: Prepare vis packets directly inside a skb

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: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b706007b
* 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 * Request a new review
* Process the comments from the review * Process the comments from the review
* Move into mainline proper * Move into mainline proper
......
...@@ -99,23 +99,6 @@ int send_skb_packet(struct sk_buff *skb, ...@@ -99,23 +99,6 @@ int send_skb_packet(struct sk_buff *skb,
return NET_XMIT_DROP; 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 */ /* Send a packet to a given interface */
static void send_packet_to_if(struct forw_packet *forw_packet, static void send_packet_to_if(struct forw_packet *forw_packet,
struct batman_if *batman_if) struct batman_if *batman_if)
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
int send_skb_packet(struct sk_buff *skb, int send_skb_packet(struct sk_buff *skb,
struct batman_if *batman_if, struct batman_if *batman_if,
uint8_t *dst_addr); 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_own_packet(struct batman_if *batman_if);
void schedule_forward_packet(struct orig_node *orig_node, void schedule_forward_packet(struct orig_node *orig_node,
struct ethhdr *ethhdr, struct ethhdr *ethhdr,
......
This diff is collapsed.
...@@ -32,7 +32,7 @@ struct vis_info { ...@@ -32,7 +32,7 @@ struct vis_info {
struct list_head send_list; struct list_head send_list;
struct kref refcount; struct kref refcount;
/* this packet might be part of the vis send queue. */ /* this packet might be part of the vis send queue. */
struct vis_packet packet; struct sk_buff *skb_packet;
/* vis_info may follow here*/ /* vis_info may follow here*/
} __attribute__((packed)); } __attribute__((packed));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment