Commit 26f2eb27 authored by wenxu's avatar wenxu Committed by David S. Miller

flow_offload: add flow_indr_block_cb_alloc/remove function

Add flow_indr_block_cb_alloc/remove function for next fix patch.
Signed-off-by: default avatarwenxu <wenxu@ucloud.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 56c09de3
...@@ -467,6 +467,12 @@ struct flow_block_cb { ...@@ -467,6 +467,12 @@ struct flow_block_cb {
struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb, struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv, void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv)); void (*release)(void *cb_priv));
struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv),
struct flow_block_offload *bo,
struct net_device *dev, void *data,
void (*cleanup)(struct flow_block_cb *block_cb));
void flow_block_cb_free(struct flow_block_cb *block_cb); void flow_block_cb_free(struct flow_block_cb *block_cb);
struct flow_block_cb *flow_block_cb_lookup(struct flow_block *block, struct flow_block_cb *flow_block_cb_lookup(struct flow_block *block,
...@@ -488,6 +494,13 @@ static inline void flow_block_cb_remove(struct flow_block_cb *block_cb, ...@@ -488,6 +494,13 @@ static inline void flow_block_cb_remove(struct flow_block_cb *block_cb,
list_move(&block_cb->list, &offload->cb_list); list_move(&block_cb->list, &offload->cb_list);
} }
static inline void flow_indr_block_cb_remove(struct flow_block_cb *block_cb,
struct flow_block_offload *offload)
{
list_del(&block_cb->indr.list);
list_move(&block_cb->list, &offload->cb_list);
}
bool flow_block_cb_is_busy(flow_setup_cb_t *cb, void *cb_ident, bool flow_block_cb_is_busy(flow_setup_cb_t *cb, void *cb_ident,
struct list_head *driver_block_list); struct list_head *driver_block_list);
......
...@@ -437,6 +437,27 @@ static void flow_block_indr_init(struct flow_block_cb *flow_block, ...@@ -437,6 +437,27 @@ static void flow_block_indr_init(struct flow_block_cb *flow_block,
flow_block->indr.cleanup = cleanup; flow_block->indr.cleanup = cleanup;
} }
struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
void *cb_ident, void *cb_priv,
void (*release)(void *cb_priv),
struct flow_block_offload *bo,
struct net_device *dev, void *data,
void (*cleanup)(struct flow_block_cb *block_cb))
{
struct flow_block_cb *block_cb;
block_cb = flow_block_cb_alloc(cb, cb_ident, cb_priv, release);
if (IS_ERR(block_cb))
goto out;
flow_block_indr_init(block_cb, bo, dev, data, cleanup);
list_add(&block_cb->indr.list, &flow_block_indr_list);
out:
return block_cb;
}
EXPORT_SYMBOL(flow_indr_block_cb_alloc);
static void __flow_block_indr_binding(struct flow_block_offload *bo, static void __flow_block_indr_binding(struct flow_block_offload *bo,
struct net_device *dev, void *data, struct net_device *dev, void *data,
void (*cleanup)(struct flow_block_cb *block_cb)) void (*cleanup)(struct flow_block_cb *block_cb))
......
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