@@ -787,7 +787,7 @@ struct nft_expr_ops {
int (*offload)(struct nft_offload_ctx *ctx,
struct nft_flow_rule *flow,
const struct nft_expr *expr);
- u32 offload_flags;
+ int (*offload_actions)(const struct nft_expr *expr);
const struct nft_expr_type *type;
void *data;
};
@@ -796,6 +796,11 @@ struct nft_expr_ops {
#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
ALIGN(size, __alignof__(struct nft_expr)))
+static inline int nft_offload_action(const struct nft_expr *expr)
+{
+ return 1;
+}
+
/**
* struct nft_expr - nf_tables expression
*
@@ -59,8 +59,6 @@ struct nft_flow_rule {
struct flow_rule *rule;
};
-#define NFT_OFFLOAD_F_ACTION (1 << 0)
-
struct nft_rule;
struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rule *rule);
void nft_flow_rule_destroy(struct nft_flow_rule *flow);
@@ -42,8 +42,8 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rul
expr = nft_expr_first(rule);
while (expr->ops && expr != nft_expr_last(rule)) {
- if (expr->ops->offload_flags & NFT_OFFLOAD_F_ACTION)
- num_actions++;
+ if (expr->ops->offload_actions)
+ num_actions += expr->ops->offload_actions(expr);
expr = nft_expr_next(expr);
}
@@ -173,7 +173,7 @@ static int nft_immediate_offload(struct nft_offload_ctx *ctx,
.dump = nft_immediate_dump,
.validate = nft_immediate_validate,
.offload = nft_immediate_offload,
- .offload_flags = NFT_OFFLOAD_F_ACTION,
+ .offload_actions = nft_offload_action,
};
struct nft_expr_type nft_imm_type __read_mostly = {