mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
net/sched: act_api: Add extack to offload_act_setup() callback
The callback is used by various actions to populate the flow action structure prior to offload. Pass extack to this callback so that the various actions will be able to report accurate error messages to user space. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
11c95317bc
commit
c2ccf84ecb
@ -134,7 +134,8 @@ struct tc_action_ops {
|
||||
(*get_psample_group)(const struct tc_action *a,
|
||||
tc_action_priv_destructor *destructor);
|
||||
int (*offload_act_setup)(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind);
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack);
|
||||
};
|
||||
|
||||
struct tc_action_net {
|
||||
|
@ -547,10 +547,12 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
|
||||
}
|
||||
|
||||
int tc_setup_offload_action(struct flow_action *flow_action,
|
||||
const struct tcf_exts *exts);
|
||||
const struct tcf_exts *exts,
|
||||
struct netlink_ext_ack *extack);
|
||||
void tc_cleanup_offload_action(struct flow_action *flow_action);
|
||||
int tc_setup_action(struct flow_action *flow_action,
|
||||
struct tc_action *actions[]);
|
||||
struct tc_action *actions[],
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
|
||||
void *type_data, bool err_stop, bool rtnl_held);
|
||||
|
@ -195,7 +195,7 @@ static int offload_action_init(struct flow_offload_action *fl_action,
|
||||
if (act->ops->offload_act_setup) {
|
||||
spin_lock_bh(&act->tcfa_lock);
|
||||
err = act->ops->offload_act_setup(act, fl_action, NULL,
|
||||
false);
|
||||
false, extack);
|
||||
spin_unlock_bh(&act->tcfa_lock);
|
||||
return err;
|
||||
}
|
||||
@ -271,7 +271,7 @@ static int tcf_action_offload_add_ex(struct tc_action *action,
|
||||
if (err)
|
||||
goto fl_err;
|
||||
|
||||
err = tc_setup_action(&fl_action->action, actions);
|
||||
err = tc_setup_action(&fl_action->action, actions, extack);
|
||||
if (err) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"Failed to setup tc actions for offload");
|
||||
|
@ -696,7 +696,8 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act)
|
||||
}
|
||||
|
||||
static int tcf_csum_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -1584,7 +1584,8 @@ static void tcf_stats_update(struct tc_action *a, u64 bytes, u64 packets,
|
||||
}
|
||||
|
||||
static int tcf_ct_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -253,7 +253,8 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act)
|
||||
}
|
||||
|
||||
static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -619,7 +619,8 @@ static int tcf_gate_get_entries(struct flow_action_entry *entry,
|
||||
}
|
||||
|
||||
static int tcf_gate_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -460,7 +460,8 @@ static void tcf_offload_mirred_get_dev(struct flow_action_entry *entry,
|
||||
}
|
||||
|
||||
static int tcf_mirred_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -385,7 +385,8 @@ static int tcf_mpls_search(struct net *net, struct tc_action **a, u32 index)
|
||||
}
|
||||
|
||||
static int tcf_mpls_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -488,7 +488,8 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index)
|
||||
}
|
||||
|
||||
static int tcf_pedit_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -442,7 +442,8 @@ static int tcf_police_act_to_flow_act(int tc_act, u32 *extval)
|
||||
}
|
||||
|
||||
static int tcf_police_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -291,7 +291,8 @@ static void tcf_offload_sample_get_group(struct flow_action_entry *entry,
|
||||
}
|
||||
|
||||
static int tcf_sample_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -328,7 +328,8 @@ static size_t tcf_skbedit_get_fill_size(const struct tc_action *act)
|
||||
}
|
||||
|
||||
static int tcf_skbedit_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -808,7 +808,8 @@ static int tcf_tunnel_encap_get_tunnel(struct flow_action_entry *entry,
|
||||
static int tcf_tunnel_key_offload_act_setup(struct tc_action *act,
|
||||
void *entry_data,
|
||||
u32 *index_inc,
|
||||
bool bind)
|
||||
bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -369,7 +369,8 @@ static size_t tcf_vlan_get_fill_size(const struct tc_action *act)
|
||||
}
|
||||
|
||||
static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data,
|
||||
u32 *index_inc, bool bind)
|
||||
u32 *index_inc, bool bind,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if (bind) {
|
||||
struct flow_action_entry *entry = entry_data;
|
||||
|
@ -3513,11 +3513,13 @@ EXPORT_SYMBOL(tc_cleanup_offload_action);
|
||||
|
||||
static int tc_setup_offload_act(struct tc_action *act,
|
||||
struct flow_action_entry *entry,
|
||||
u32 *index_inc)
|
||||
u32 *index_inc,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
if (act->ops->offload_act_setup)
|
||||
return act->ops->offload_act_setup(act, entry, index_inc, true);
|
||||
return act->ops->offload_act_setup(act, entry, index_inc, true,
|
||||
extack);
|
||||
else
|
||||
return -EOPNOTSUPP;
|
||||
#else
|
||||
@ -3526,7 +3528,8 @@ static int tc_setup_offload_act(struct tc_action *act,
|
||||
}
|
||||
|
||||
int tc_setup_action(struct flow_action *flow_action,
|
||||
struct tc_action *actions[])
|
||||
struct tc_action *actions[],
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int i, j, index, err = 0;
|
||||
struct tc_action *act;
|
||||
@ -3551,7 +3554,7 @@ int tc_setup_action(struct flow_action *flow_action,
|
||||
entry->hw_stats = tc_act_hw_stats(act->hw_stats);
|
||||
entry->hw_index = act->tcfa_index;
|
||||
index = 0;
|
||||
err = tc_setup_offload_act(act, entry, &index);
|
||||
err = tc_setup_offload_act(act, entry, &index, extack);
|
||||
if (!err)
|
||||
j += index;
|
||||
else
|
||||
@ -3570,13 +3573,14 @@ err_out_locked:
|
||||
}
|
||||
|
||||
int tc_setup_offload_action(struct flow_action *flow_action,
|
||||
const struct tcf_exts *exts)
|
||||
const struct tcf_exts *exts,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
if (!exts)
|
||||
return 0;
|
||||
|
||||
return tc_setup_action(flow_action, exts->actions);
|
||||
return tc_setup_action(flow_action, exts->actions, extack);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -464,7 +464,8 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
|
||||
cls_flower.rule->match.key = &f->mkey;
|
||||
cls_flower.classid = f->res.classid;
|
||||
|
||||
err = tc_setup_offload_action(&cls_flower.rule->action, &f->exts);
|
||||
err = tc_setup_offload_action(&cls_flower.rule->action, &f->exts,
|
||||
cls_flower.common.extack);
|
||||
if (err) {
|
||||
kfree(cls_flower.rule);
|
||||
NL_SET_ERR_MSG_MOD(cls_flower.common.extack,
|
||||
@ -2353,7 +2354,8 @@ static int fl_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
|
||||
cls_flower.rule->match.mask = &f->mask->key;
|
||||
cls_flower.rule->match.key = &f->mkey;
|
||||
|
||||
err = tc_setup_offload_action(&cls_flower.rule->action, &f->exts);
|
||||
err = tc_setup_offload_action(&cls_flower.rule->action, &f->exts,
|
||||
cls_flower.common.extack);
|
||||
if (err) {
|
||||
kfree(cls_flower.rule);
|
||||
NL_SET_ERR_MSG_MOD(cls_flower.common.extack,
|
||||
|
@ -97,7 +97,8 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
|
||||
cls_mall.command = TC_CLSMATCHALL_REPLACE;
|
||||
cls_mall.cookie = cookie;
|
||||
|
||||
err = tc_setup_offload_action(&cls_mall.rule->action, &head->exts);
|
||||
err = tc_setup_offload_action(&cls_mall.rule->action, &head->exts,
|
||||
cls_mall.common.extack);
|
||||
if (err) {
|
||||
kfree(cls_mall.rule);
|
||||
mall_destroy_hw_filter(tp, head, cookie, NULL);
|
||||
@ -300,7 +301,8 @@ static int mall_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
|
||||
TC_CLSMATCHALL_REPLACE : TC_CLSMATCHALL_DESTROY;
|
||||
cls_mall.cookie = (unsigned long)head;
|
||||
|
||||
err = tc_setup_offload_action(&cls_mall.rule->action, &head->exts);
|
||||
err = tc_setup_offload_action(&cls_mall.rule->action, &head->exts,
|
||||
cls_mall.common.extack);
|
||||
if (err) {
|
||||
kfree(cls_mall.rule);
|
||||
NL_SET_ERR_MSG_MOD(cls_mall.common.extack,
|
||||
|
Loading…
Reference in New Issue
Block a user