Skip to content

Commit 26f2eb2

Browse files
wenxudavem330
authored andcommitted
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: wenxu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 56c09de commit 26f2eb2

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

include/net/flow_offload.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,12 @@ struct flow_block_cb {
467467
struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb,
468468
void *cb_ident, void *cb_priv,
469469
void (*release)(void *cb_priv));
470+
struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
471+
void *cb_ident, void *cb_priv,
472+
void (*release)(void *cb_priv),
473+
struct flow_block_offload *bo,
474+
struct net_device *dev, void *data,
475+
void (*cleanup)(struct flow_block_cb *block_cb));
470476
void flow_block_cb_free(struct flow_block_cb *block_cb);
471477

472478
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,
488494
list_move(&block_cb->list, &offload->cb_list);
489495
}
490496

497+
static inline void flow_indr_block_cb_remove(struct flow_block_cb *block_cb,
498+
struct flow_block_offload *offload)
499+
{
500+
list_del(&block_cb->indr.list);
501+
list_move(&block_cb->list, &offload->cb_list);
502+
}
503+
491504
bool flow_block_cb_is_busy(flow_setup_cb_t *cb, void *cb_ident,
492505
struct list_head *driver_block_list);
493506

net/core/flow_offload.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,27 @@ static void flow_block_indr_init(struct flow_block_cb *flow_block,
437437
flow_block->indr.cleanup = cleanup;
438438
}
439439

440+
struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
441+
void *cb_ident, void *cb_priv,
442+
void (*release)(void *cb_priv),
443+
struct flow_block_offload *bo,
444+
struct net_device *dev, void *data,
445+
void (*cleanup)(struct flow_block_cb *block_cb))
446+
{
447+
struct flow_block_cb *block_cb;
448+
449+
block_cb = flow_block_cb_alloc(cb, cb_ident, cb_priv, release);
450+
if (IS_ERR(block_cb))
451+
goto out;
452+
453+
flow_block_indr_init(block_cb, bo, dev, data, cleanup);
454+
list_add(&block_cb->indr.list, &flow_block_indr_list);
455+
456+
out:
457+
return block_cb;
458+
}
459+
EXPORT_SYMBOL(flow_indr_block_cb_alloc);
460+
440461
static void __flow_block_indr_binding(struct flow_block_offload *bo,
441462
struct net_device *dev, void *data,
442463
void (*cleanup)(struct flow_block_cb *block_cb))

0 commit comments

Comments
 (0)