From patchwork Thu Feb 15 15:54:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 873960 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mojatatu-com.20150623.gappssmtp.com header.i=@mojatatu-com.20150623.gappssmtp.com header.b="LoKBJu1T"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zj18m3KZ2z9t1t for ; Fri, 16 Feb 2018 02:56:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425354AbeBOP4G (ORCPT ); Thu, 15 Feb 2018 10:56:06 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:32786 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424930AbeBOP4E (ORCPT ); Thu, 15 Feb 2018 10:56:04 -0500 Received: by mail-io0-f195.google.com with SMTP id n7so1079796iob.0 for ; Thu, 15 Feb 2018 07:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8aXf6Z9e5Cn77sYVo/t0YqV9EZmuftk8TODRPeI+YA4=; b=LoKBJu1T/gXJSXUiMPe9D9i5sFaSFPnrQusmZq80/Mc2UrUxiFDjntdZnvoZksfnEy U7edN2ha+5kja5xlstsit3pxAPRA0sIR4Gxh1gEZzmATgE2mHKIwv8D3KK+cyq5OLLf1 DyC5KlFmEyFwmANzy1vVcjnkqC1EoxblAXCKz+hxlI5h8s9qVMfh6ruh4VNjWTWiXG3u +1nu+9XgaYXK9Mg+dNfwLtVfk7I9Ure+MIKJF32g4BkkcVpH7Zc590k18m3yk7wzFTjm 5OWHfoNgUY5KQMU3kfEXPArVW/nunxJhmY7L3COj2PIyGA+Sv2n3xusT9emanqtLpbPF KJRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8aXf6Z9e5Cn77sYVo/t0YqV9EZmuftk8TODRPeI+YA4=; b=GhhD3AoQ8/YlwadaWSnl9BocOdqy3E2Yrb8YzBlmqNrbNs+2ygSDNWSF3C6myyJFPv cmDeQkrXiZJqAQJ1SZPi5T/JgLQXTLNmqg0fxjp0rTfBm3H4rDpjgKFCTJj1c0YUgapi IaV8tj/7Ysg/vDUBAdxXtByIkt3o887WD9Gx2xQ8YbA7Vqz7zy0GXs07ArUv6HFNkdqm eYu5QMqJwZE+LBtBwKTH1Bl2SeApnuhP7Edgb5U3EXaom0FTMvCBfqqCX8oyWzwEhPcj hQjh69Eo0jSX/PjR7y//cQF9EJzJBFllCnobkdKU0fCwjJiJgh3y0NE5omMnm86E00KA Xl3A== X-Gm-Message-State: APf1xPBnpmlu/AoK8JrK3PoXQlpp13VplLSND0ZAY/3brersXl7EzQEY uPLwDQqZznw2pdp0xZmnZythLA== X-Google-Smtp-Source: AH8x224rCz0GErpbjPNIfGT2nG55HxR0MvgkWH7rn7OAkU8/+Ud9XY3Q6wZey/hLKRny358V6p59wQ== X-Received: by 10.107.142.13 with SMTP id q13mr4111074iod.299.1518710163855; Thu, 15 Feb 2018 07:56:03 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id h2sm627986ioa.77.2018.02.15.07.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 07:56:03 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, kernel@mojatatu.com, dcaratti@redhat.com, Alexander Aring , David Ahern Subject: [PATCHv3 net-next 2/8] net: sched: act: add extack to init Date: Thu, 15 Feb 2018 10:54:54 -0500 Message-Id: <20180215155500.23578-3-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180215155500.23578-1-aring@mojatatu.com> References: <20180215155500.23578-1-aring@mojatatu.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds extack to tcf_action_init and tcf_action_init_1 functions. These are necessary to make individual extack handling in each act implementation. Based on work by David Ahern Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/act_api.h | 5 +++-- net/sched/act_api.c | 17 +++++++++++------ net/sched/cls_api.c | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 32ef544f4ddc..41d95930ffbc 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -163,10 +163,11 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, int nr_actions, struct tcf_result *res); int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct list_head *actions); + struct list_head *actions, struct netlink_ext_ack *extack); struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, - char *name, int ovr, int bind); + char *name, int ovr, int bind, + struct netlink_ext_ack *extack); int tcf_action_dump(struct sk_buff *skb, struct list_head *, int, int); int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index becc63689fae..8d89b026414f 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -605,7 +605,8 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb) struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, - char *name, int ovr, int bind) + char *name, int ovr, int bind, + struct netlink_ext_ack *extack) { struct tc_action *a; struct tc_action_ops *a_o; @@ -726,7 +727,7 @@ static void cleanup_a(struct list_head *actions, int ovr) int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, struct nlattr *est, char *name, int ovr, int bind, - struct list_head *actions) + struct list_head *actions, struct netlink_ext_ack *extack) { struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; struct tc_action *act; @@ -738,7 +739,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, return err; for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { - act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind); + act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind, + extack); if (IS_ERR(act)) { err = PTR_ERR(act); goto err; @@ -1060,12 +1062,14 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, } static int tcf_action_add(struct net *net, struct nlattr *nla, - struct nlmsghdr *n, u32 portid, int ovr) + struct nlmsghdr *n, u32 portid, int ovr, + struct netlink_ext_ack *extack) { int ret = 0; LIST_HEAD(actions); - ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions); + ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions, + extack); if (ret) return ret; @@ -1113,7 +1117,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, if (n->nlmsg_flags & NLM_F_REPLACE) ovr = 1; replay: - ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr); + ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr, + extack); if (ret == -EAGAIN) goto replay; break; diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 2bc1bc23d42e..f21610c5da1a 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1434,7 +1434,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, if (exts->police && tb[exts->police]) { act = tcf_action_init_1(net, tp, tb[exts->police], rate_tlv, "police", ovr, - TCA_ACT_BIND); + TCA_ACT_BIND, extack); if (IS_ERR(act)) return PTR_ERR(act); @@ -1447,7 +1447,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, err = tcf_action_init(net, tp, tb[exts->action], rate_tlv, NULL, ovr, TCA_ACT_BIND, - &actions); + &actions, extack); if (err) return err; list_for_each_entry(act, &actions, list)