Commit d6c050e9 authored by Vikram Narayanan's avatar Vikram Narayanan
Browse files

lcd/ixgbe: Add flow dissector helpers to liblcd



This saves us a crossover during packet reception
Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <vikram186@gmail.com>
parent bcdcb5cc
This diff is collapsed.
#include <lcd_config/pre_hook.h>
#include <linux/skbuff.h>
#include <lcd_config/post_hook.h>
void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
int size, unsigned int truesize)
{
skb_fill_page_desc(skb, i, page, off, size);
skb->len += size;
skb->data_len += size;
skb->truesize += truesize;
}
EXPORT_SYMBOL(skb_add_rx_frag);
/**
* eth_get_headlen - determine the length of header for an ethernet frame
* @data: pointer to start of frame
* @len: total length of frame
*
* Make a best effort attempt to pull the length for all of the headers for
* a given frame in a linear buffer.
*/
u32 eth_get_headlen(void *data, unsigned int len)
{
const unsigned int flags = FLOW_DISSECTOR_F_PARSE_1ST_FRAG;
const struct ethhdr *eth = (const struct ethhdr *)data;
struct flow_keys keys;
/* this should never happen, but better safe than sorry */
if (unlikely(len < sizeof(*eth)))
return len;
/* parse any remaining L2/L3 headers, check for L4 */
if (!skb_flow_dissect_flow_keys_buf(&keys, data, eth->h_proto,
sizeof(*eth), len, flags))
return max_t(u32, keys.control.thoff, sizeof(*eth));
/* parse for any L4 headers */
return min_t(u32, __skb_get_poff(NULL, data, &keys, len), len);
}
EXPORT_SYMBOL(eth_get_headlen);
......@@ -64,6 +64,8 @@ lib-y += $(addprefix liblcd/arch/x86/dma/, \
lib-y += $(addprefix liblcd/net/, \
dev_addr_lists.o \
dev.o \
skbuff.o \
flow_dissector.o \
)
lib-y += liblcd/resolve.o
......
......@@ -38,6 +38,8 @@ struct kmem_cache *skbuff_cache;
#define CPTR_HASH_BITS 5
static DEFINE_HASHTABLE(cptr_table, CPTR_HASH_BITS);
extern int init_default_flow_dissectors(void);
int glue_ixgbe_init(void)
{
int ret;
......@@ -54,6 +56,9 @@ int glue_ixgbe_init(void)
ixgbe_cspace = c_cspace;
hash_init(cptr_table);
LIBLCD_MSG("dissector init ret %d",
init_default_flow_dissectors());
/* merge two datastructures into one for allocation */
skb_c_cache = kmem_cache_create("skb_c_cache",
sizeof(struct sk_buff_container)
......
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