From patchwork Mon Feb 12 20:19:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872371 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="1vGssk10"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8f5Z7Zz9sRm for ; Tue, 13 Feb 2018 07:20:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753566AbeBLUTq (ORCPT ); Mon, 12 Feb 2018 15:19:46 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:34084 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752470AbeBLUTk (ORCPT ); Mon, 12 Feb 2018 15:19:40 -0500 Received: by mail-io0-f195.google.com with SMTP id e7so4454676ioj.1 for ; Mon, 12 Feb 2018 12:19:40 -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=eqBoLnRc5rkV2W+6O3khc0+RpsATU6p+W3b3wFSkRjM=; b=1vGssk10cP2U8DNnS7ygzeBGl82+E5qbbDOjOLjdpnI0wq3Gt+1MEH5c0Uj959QVC+ bWdJ6B4eq8x5KezXsgY+NY7zNOw+pmdU7EZT/xJjm4+UtorG12O0sGx3WZitGDd80CrE Q/ugD1Cios3g9ouZNfZl66DJ1sncknQUGFPCbUVY7xUK1YNkdrUWAx0Q7lqTg9BmYJ1S itFteL3WwkOT04K0kAT8YnWdQYb+U3gDqcM2nNdr6tnWwVRX6L14iguIJL1nw8WjwR3q n9dEEhTl4UgzzgTFc6uO3ktBNhBCdItnxYio652PxdEbkdRRM0L3kQQ5/AGSpAYbUhNa j8Cg== 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=eqBoLnRc5rkV2W+6O3khc0+RpsATU6p+W3b3wFSkRjM=; b=AIpcDkafoTdv3wnMmYBWoFTsNINJAgzLkcZCQ1UR5n1cdTvZeifQ3Od/6ODjwuvhv6 KtD2uHTGAWPnGfDRMxc8wdY+cZNC76aZmn7n5XfUTA6GqsAEqvjbEW1JBMCKkDVF+97y e9umeagwXk6q87I4wYpORRkJo/l0OBfgLKMOkeZBdYywH3BNuBb1FRekNGxr7GXYEgMH cjM5YPp2F+pPrVZSvBdewjqRYhPTzhngehWigL4hR7TYdwD10DDbHDZbgqqnonta8Ma1 BNMfYEwmpzq3wqnEN5xVgjVL9UNTa9+IwyWibLQ+fKWlp4gUApLNj7fziON+gZ0DXgoK fB7w== X-Gm-Message-State: APf1xPA2R/Jk1Hf1QJdZnsOD6uiBA9UjeVxgyGmVNV0B0Y8MPANeadcZ ZRhPJRxQlT6aV2GQWRzQLFNL+g== X-Google-Smtp-Source: AH8x225Uy7xdtUAZJ8IjZq9r2MSKe01EriinVnWR8VBD1G0uxOnwVCDCuWwCFHe58SShXizzie1CjQ== X-Received: by 10.107.212.24 with SMTP id l24mr15606093iog.40.1518466780186; Mon, 12 Feb 2018 12:19:40 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:39 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring Subject: [PATCH net-next 1/8] net: sched: act: fix code style Date: Mon, 12 Feb 2018 15:19:04 -0500 Message-Id: <20180212201911.18704-2-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-1-aring@mojatatu.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch is used by subsequent patches. It fixes code style issues caught by checkpatch. Signed-off-by: Alexander Aring --- include/net/act_api.h | 5 +++-- net/sched/act_api.c | 12 ++++++------ net/sched/act_mirred.c | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 6ed9692f20bd..32ef544f4ddc 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -87,12 +87,13 @@ struct tc_action_ops { struct tcf_result *); int (*dump)(struct sk_buff *, struct tc_action *, int, int); void (*cleanup)(struct tc_action *); - int (*lookup)(struct net *, struct tc_action **, u32); + int (*lookup)(struct net *net, struct tc_action **a, u32 index); int (*init)(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **act, int ovr, int bind); int (*walk)(struct net *, struct sk_buff *, - struct netlink_callback *, int, const struct tc_action_ops *); + struct netlink_callback *, int, + const struct tc_action_ops *); void (*stats_update)(struct tc_action *, u64, u32, u64); struct net_device *(*get_dev)(const struct tc_action *a); }; diff --git a/net/sched/act_api.c b/net/sched/act_api.c index eba6682727dd..d885b3127e53 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -621,7 +621,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, goto err_out; err = -EINVAL; kind = tb[TCA_ACT_KIND]; - if (kind == NULL) + if (!kind) goto err_out; if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) goto err_out; @@ -822,7 +822,7 @@ static int tca_get_fill(struct sk_buff *skb, struct list_head *actions, t->tca__pad2 = 0; nest = nla_nest_start(skb, TCA_ACT_TAB); - if (nest == NULL) + if (!nest) goto out_nlmsg_trim; if (tcf_action_dump(skb, actions, bind, ref) < 0) @@ -934,7 +934,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, t->tca__pad2 = 0; nest = nla_nest_start(skb, TCA_ACT_TAB); - if (nest == NULL) + if (!nest) goto out_module_put; err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops); @@ -1005,10 +1005,10 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, return ret; if (event == RTM_DELACTION && n->nlmsg_flags & NLM_F_ROOT) { - if (tb[1] != NULL) + if (tb[1]) return tca_action_flush(net, tb[1], n, portid); - else - return -EINVAL; + + return -EINVAL; } for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index e6ff88f72900..abcd5f12b913 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -80,12 +80,12 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, bool exists = false; int ret; - if (nla == NULL) + if (!nla) return -EINVAL; ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, NULL); if (ret < 0) return ret; - if (tb[TCA_MIRRED_PARMS] == NULL) + if (!tb[TCA_MIRRED_PARMS]) return -EINVAL; parm = nla_data(tb[TCA_MIRRED_PARMS]); @@ -117,7 +117,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, } if (!exists) { - if (dev == NULL) + if (!dev) return -EINVAL; ret = tcf_idr_create(tn, parm->index, est, a, &act_mirred_ops, bind, true); From patchwork Mon Feb 12 20:19:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872373 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="00gvPXBL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8p3ZHGz9t32 for ; Tue, 13 Feb 2018 07:20:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbeBLUTp (ORCPT ); Mon, 12 Feb 2018 15:19:45 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:51298 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753220AbeBLUTm (ORCPT ); Mon, 12 Feb 2018 15:19:42 -0500 Received: by mail-it0-f65.google.com with SMTP id 193so5388523iti.1 for ; Mon, 12 Feb 2018 12:19:41 -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=RvT+1IeszKDEewE0QlULCuqyIKN7XjCNYCZKFkT02bY=; b=00gvPXBL8FtIYdUHZqajxwDHgT/TZ1DLtjhfMppNmesy3mM2AM049eYATZXlpd0ltH O1at8AQciPqqD2OLbKlA1P5ZoSCkv6lLeGi0t7lGiBgJU8pxV68eGW8B/Cax5YmzDF8N UMWHHRM+mqOHvNTHiMltvHavDPPkkUEQCr4uLy5IrY/bodx9zJQuADsrmKm/UOIVLfue +HnL8oI5zoG5B9w5VoN7dJqZMhQYcsHzdGWiitPfqpHKt2ykVAoFPeKf10VaFmRG7G0k q7AmtHAiE3CkE9qO+jLRAxSQCJD+ooJc7gS0R2USHHpHNgM374OgAFpwvNzE0KsTv5OE 3b0Q== 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=RvT+1IeszKDEewE0QlULCuqyIKN7XjCNYCZKFkT02bY=; b=ni4w1b7+uNsHFgSXNLtmCOk180dIAbKH0+PvdDUMvrLv/MLRf0TCotXQPZ+JXfzpcv QZXcHncva0xWBpZZC7IppUKoHqy2bxss9YxklZavN8Knm2xyAT/EJed3nKxgERZulp3Y oB9PdD3HYPwpiji3UIfNqzcc3W4lPRxCz35QOowrwNgIc5oUHTZC6BvoGkpAefc88PWh iYkbsRZZ5UnaaYxnYsfjHH/bAIriQDIqzHSsRiIsPUeN6QVTYw4WgUSo8FfpbnrxOhNP rSn4YZZEsRABN5hd76LLYAWY6vqoh9KsCbZeWNwATgK+0a6AAHuX0mphczW+DEdEhpZ6 K8xQ== X-Gm-Message-State: APf1xPDg08I08pC35NQFXjZggMkFV/aOXmyczN0jzWIrqkdtYw+R7vQ7 faNoh1DvjeVVNBbGukjvQTEMEA== X-Google-Smtp-Source: AH8x224bgesbmJilsQwy+OR9okul/Pg+r2vJiDiJkYvISKj/JsXczuzqRwHDBiBDfAQWZeTCB3cBqQ== X-Received: by 10.36.94.210 with SMTP id h201mr7019100itb.40.1518466781325; Mon, 12 Feb 2018 12:19:41 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:40 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 2/8] net: sched: act: add extack to init Date: Mon, 12 Feb 2018 15:19:05 -0500 Message-Id: <20180212201911.18704-3-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 d885b3127e53..db7500d613fc 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) From patchwork Mon Feb 12 20:19:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872368 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="090geX89"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8P720nz9sRm for ; Tue, 13 Feb 2018 07:19:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753760AbeBLUTr (ORCPT ); Mon, 12 Feb 2018 15:19:47 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:40610 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbeBLUTn (ORCPT ); Mon, 12 Feb 2018 15:19:43 -0500 Received: by mail-it0-f66.google.com with SMTP id v186so2842587itc.5 for ; Mon, 12 Feb 2018 12:19:42 -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=OP1ysjB1a1k36HlbqJtoAFQiCECxGOD252skd6bnb90=; b=090geX89E6iItEK6DS+96ozhTvZXeuzoJ/CHru+AwKL2JAOO3M07YFqno8fl/n0H4f yZv/SBQBTX90c3WY8XIRIZZTsvEQZjC8mcTIEpcKl4DPMx6InjWNySXwxYln0Qq6JPZl 9YnCxgjH7onqIWoSbllo86U8AqpMq/+khi6bSOkbUrnmwiA/2el4EcJd4yAbXlxfa4LD zLM0Z5d1FfEiw1jgVDHd9yavkKHvYFgSV90ZZAizIyBTK7j0xNQvDfRyS+ZHwMjBUKGI uFycPR9x8BOl6uFKsy8eeEMLSOw0P9JovzlzyUOYuou2CGQNeoRq8m+FqGohTaDfnrgi EJXQ== 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=OP1ysjB1a1k36HlbqJtoAFQiCECxGOD252skd6bnb90=; b=ZOmqEXDkLGRn1dtaAxnhU9U+2zEMEIpcEqsqgByJzQ0ZPb2IS1DhezhJwhNx+6aKld EvCdsmzGJQ6WW5juzAIWH96m7+1kXXgTOg0CQNSZjyOfVNHcstFHxYVGfjWhbDqSBZvf a0IndhrbiyXKDXKyfGcr8x9pwkaVkb/AP95mGkBdYAtEbEBuoaQj9gnOQrn7tAIAy9eN lsvyTzNS73pTkCTdz7SFJsWQvyK/zZv8r4aBvvdvZRuYhKJ1kNF+oH8Zf2U30ov+pLln 9gEHf5WPP/JSEOoenGKz/lqPf0PF7smBFl/hs8REx8kjzKYth4FoVD3FokddI0P8VSO4 2aAQ== X-Gm-Message-State: APf1xPDv9CLbVznCzN7q/sK2h6oA2i1OcCNE1rhKuFanMzzEGST6eKQB cuDWKCBXFFponeQDql4havNQuA== X-Google-Smtp-Source: AH8x225ggxpoOF0+4Y9F0SO38SNmkt1XmV4/ZWjg/DHpg1WBKtWVsiee9lxKxnTqEGtCrJfqJd6QZg== X-Received: by 10.36.65.141 with SMTP id b13mr7009906itd.0.1518466782372; Mon, 12 Feb 2018 12:19:42 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:41 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 3/8] net: sched: act: handle generic action errors Date: Mon, 12 Feb 2018 15:19:06 -0500 Message-Id: <20180212201911.18704-4-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 support for generic act handling. The extack will be set deeper to each called function which is not part of netdev core api. Based on work by David Ahern Cc: David Ahern Signed-off-by: Alexander Aring --- net/sched/act_api.c | 93 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index db7500d613fc..90ae3593ca2b 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -617,31 +617,40 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, int err; if (name == NULL) { - err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, NULL); + err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); if (err < 0) goto err_out; err = -EINVAL; kind = tb[TCA_ACT_KIND]; - if (!kind) + if (!kind) { + NL_SET_ERR_MSG(extack, "TC action kind must be specified"); goto err_out; - if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) + } + if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) { + NL_SET_ERR_MSG(extack, "TC action name too long"); goto err_out; + } if (tb[TCA_ACT_COOKIE]) { int cklen = nla_len(tb[TCA_ACT_COOKIE]); - if (cklen > TC_COOKIE_MAX_SIZE) + if (cklen > TC_COOKIE_MAX_SIZE) { + NL_SET_ERR_MSG(extack, "TC cookie size above the maximum"); goto err_out; + } cookie = nla_memdup_cookie(tb); if (!cookie) { + NL_SET_ERR_MSG(extack, "No memory to generate TC cookie"); err = -ENOMEM; goto err_out; } } } else { - err = -EINVAL; - if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ) + if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ) { + NL_SET_ERR_MSG(extack, "TC action name too long"); + err = -EINVAL; goto err_out; + } } a_o = tc_lookup_action_n(act_name); @@ -664,6 +673,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, goto err_mod; } #endif + NL_SET_ERR_MSG(extack, "Failed to load TC action module"); err = -ENOENT; goto err_out; } @@ -698,6 +708,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, list_add_tail(&a->list, &actions); tcf_action_destroy(&actions, bind); + NL_SET_ERR_MSG(extack, "Failed to init action chain"); return ERR_PTR(err); } } @@ -734,7 +745,7 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, int err; int i; - err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, NULL); + err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); if (err < 0) return err; @@ -842,7 +853,8 @@ static int tca_get_fill(struct sk_buff *skb, struct list_head *actions, static int tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n, - struct list_head *actions, int event) + struct list_head *actions, int event, + struct netlink_ext_ack *extack) { struct sk_buff *skb; @@ -851,6 +863,7 @@ tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n, return -ENOBUFS; if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event, 0, 0) <= 0) { + NL_SET_ERR_MSG(extack, "Failed to fill netlink tc action attributes"); kfree_skb(skb); return -EINVAL; } @@ -859,7 +872,8 @@ tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n, } static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla, - struct nlmsghdr *n, u32 portid) + struct nlmsghdr *n, u32 portid, + struct netlink_ext_ack *extack) { struct nlattr *tb[TCA_ACT_MAX + 1]; const struct tc_action_ops *ops; @@ -867,20 +881,24 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla, int index; int err; - err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, NULL); + err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); if (err < 0) goto err_out; err = -EINVAL; if (tb[TCA_ACT_INDEX] == NULL || - nla_len(tb[TCA_ACT_INDEX]) < sizeof(index)) + nla_len(tb[TCA_ACT_INDEX]) < sizeof(index)) { + NL_SET_ERR_MSG(extack, "Invalid TC action index value"); goto err_out; + } index = nla_get_u32(tb[TCA_ACT_INDEX]); err = -EINVAL; ops = tc_lookup_action(tb[TCA_ACT_KIND]); - if (!ops) /* could happen in batch of actions */ + if (!ops) { /* could happen in batch of actions */ + NL_SET_ERR_MSG(extack, "Specified TC action not found"); goto err_out; + } err = -ENOENT; if (ops->lookup(net, &a, index) == 0) goto err_mod; @@ -895,7 +913,8 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla, } static int tca_action_flush(struct net *net, struct nlattr *nla, - struct nlmsghdr *n, u32 portid) + struct nlmsghdr *n, u32 portid, + struct netlink_ext_ack *extack) { struct sk_buff *skb; unsigned char *b; @@ -909,35 +928,39 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, int err = -ENOMEM; skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); - if (!skb) { - pr_debug("tca_action_flush: failed skb alloc\n"); + if (!skb) return err; - } b = skb_tail_pointer(skb); - err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, NULL); + err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack); if (err < 0) goto err_out; err = -EINVAL; kind = tb[TCA_ACT_KIND]; ops = tc_lookup_action(kind); - if (!ops) /*some idjot trying to flush unknown action */ + if (!ops) { /*some idjot trying to flush unknown action */ + NL_SET_ERR_MSG(extack, "Aborted Flush. Cannot flush unknown TC action"); goto err_out; + } nlh = nlmsg_put(skb, portid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t), 0); - if (!nlh) + if (!nlh) { + NL_SET_ERR_MSG(extack, "Aborted Flush. Failed to create flush netlink notification"); goto out_module_put; + } t = nlmsg_data(nlh); t->tca_family = AF_UNSPEC; t->tca__pad1 = 0; t->tca__pad2 = 0; nest = nla_nest_start(skb, TCA_ACT_TAB); - if (!nest) + if (!nest) { + NL_SET_ERR_MSG(extack, "Failed to add new netlink message"); goto out_module_put; + } err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops); if (err <= 0) @@ -952,6 +975,8 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, n->nlmsg_flags & NLM_F_ECHO); if (err > 0) return 0; + if (err < 0) + NL_SET_ERR_MSG(extack, "Failed to send flush notification"); return err; @@ -964,7 +989,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, static int tcf_del_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, - u32 portid) + u32 portid, struct netlink_ext_ack *extack) { int ret; struct sk_buff *skb; @@ -975,6 +1000,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, RTM_DELACTION, 0, 1) <= 0) { + NL_SET_ERR_MSG(extack, "Failed to fill netlink tc action attributes"); kfree_skb(skb); return -EINVAL; } @@ -982,6 +1008,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, /* now do the delete */ ret = tcf_action_destroy(actions, 0); if (ret < 0) { + NL_SET_ERR_MSG(extack, "Failed to delete TC action"); kfree_skb(skb); return ret; } @@ -995,26 +1022,27 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, static int tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, - u32 portid, int event) + u32 portid, int event, struct netlink_ext_ack *extack) { int i, ret; struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; struct tc_action *act; LIST_HEAD(actions); - ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, NULL); + ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack); if (ret < 0) return ret; if (event == RTM_DELACTION && n->nlmsg_flags & NLM_F_ROOT) { if (tb[1]) - return tca_action_flush(net, tb[1], n, portid); + return tca_action_flush(net, tb[1], n, portid, extack); + NL_SET_ERR_MSG(extack, "Invalid netlink attributes to flush actions"); return -EINVAL; } for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { - act = tcf_action_get_1(net, tb[i], n, portid); + act = tcf_action_get_1(net, tb[i], n, portid, extack); if (IS_ERR(act)) { ret = PTR_ERR(act); goto err; @@ -1024,9 +1052,9 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, } if (event == RTM_GETACTION) - ret = tcf_get_notify(net, portid, n, &actions, event); + ret = tcf_get_notify(net, portid, n, &actions, event, extack); else { /* delete */ - ret = tcf_del_notify(net, n, &actions, portid); + ret = tcf_del_notify(net, n, &actions, portid, extack); if (ret) goto err; return ret; @@ -1039,7 +1067,7 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, static int tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, - u32 portid) + u32 portid, struct netlink_ext_ack *extack) { struct sk_buff *skb; int err = 0; @@ -1050,6 +1078,7 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct list_head *actions, if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, n->nlmsg_flags, RTM_NEWACTION, 0, 0) <= 0) { + NL_SET_ERR_MSG(extack, "Failed to fill netlink tc action attributes"); kfree_skb(skb); return -EINVAL; } @@ -1073,7 +1102,7 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, if (ret) return ret; - return tcf_add_notify(net, n, &actions, portid); + return tcf_add_notify(net, n, &actions, portid, extack); } static u32 tcaa_root_flags_allowed = TCA_FLAG_LARGE_DUMP_ON; @@ -1101,7 +1130,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, return ret; if (tca[TCA_ACT_TAB] == NULL) { - pr_notice("tc_ctl_action: received NO action attribs\n"); + NL_SET_ERR_MSG(extack, "Netlink Action attributes missing"); return -EINVAL; } @@ -1124,11 +1153,11 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, break; case RTM_DELACTION: ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, - portid, RTM_DELACTION); + portid, RTM_DELACTION, extack); break; case RTM_GETACTION: ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, - portid, RTM_GETACTION); + portid, RTM_GETACTION, extack); break; default: BUG(); From patchwork Mon Feb 12 20:19:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872375 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="YakyW7iR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH932jPDz9sRm for ; Tue, 13 Feb 2018 07:20:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932134AbeBLUUU (ORCPT ); Mon, 12 Feb 2018 15:20:20 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:55758 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753269AbeBLUTo (ORCPT ); Mon, 12 Feb 2018 15:19:44 -0500 Received: by mail-it0-f67.google.com with SMTP id b66so8251460itd.5 for ; Mon, 12 Feb 2018 12:19:44 -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=87RekKa7DWOH5egeDAvh5sgHzAdn12N4W/OozvHlQcM=; b=YakyW7iRbFDFOOt3YkySuJm5OEsGPkxW1pVJuBRMAtW7nJfdf1l66FEERkYe+cxEzY dMYJ0TJ/Ghampw1D1qANQVmgN/jxMsnbXmqzyt/NF85SjzrJ3Q0er8Ko21RXwOQsxroJ +Eqf0vVNan3MgdJltiXrbYJtn0sjJIzb5bgqCRXu5cpfJ6Mk6OGqoAipihjeJFe/iyeV iHRnjjS3Y+N23ieiVsXHzubfquJyMZp50fzq5CVwT4finCjepdJmJ4r1h5ZVY0vECA6W oDZUE5b+ulj7dhhoV9EhtzbJ4HpO9H/ZluoetVre8MwbLvvlmmsR1yGkbn+1BLi9WSqq RIpw== 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=87RekKa7DWOH5egeDAvh5sgHzAdn12N4W/OozvHlQcM=; b=D9BSHjMqjVwZyfVtuNFYxRX71ArSW5XAUUsONYO+XTT3yHyB74mSZHjDG3QXWuehzT 7RQqdTd54dtkd28XL6islPUGbt6qPnVKf/lpUdwSI/3X3lTC7fluehAAvHmVIQwesHZr cgTpPZhTk5vSaeveEQ56OMhkCZofAyQYGUzWXyIQSdtrLcrlNCRd4eVDbD6tPRu+1YDm wh2VOaf5PXR/6qCWBRZVl+y38Zq+Owh90DvUno9WsJioSNFFtI7Vhpu0U7yzc5HrncMJ 1LfDhTjer7qBsCGQCp5zlQvA6Sij7IxiIeBez1eUSHFX4W4lO4ZvHgIGW4lHwVNEUAZD H9JQ== X-Gm-Message-State: APf1xPCpQud243NldPLBiaDArFblNja6+gOmsgRgFcIDONhmaL3TF6Wf ZGYmNT5c6cKNFHWyhDPWobQONA== X-Google-Smtp-Source: AH8x2271mj0k1B1SvJVkIfewYIMeRmtGIfzfZKbzCZnGcOgV4zHj+9sabt12QCQVac2tCjn4l8Ow2Q== X-Received: by 10.36.60.82 with SMTP id m79mr6855867ita.152.1518466783490; Mon, 12 Feb 2018 12:19:43 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:43 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 4/8] net: sched: act: add extack to init callback Date: Mon, 12 Feb 2018 15:19:07 -0500 Message-Id: <20180212201911.18704-5-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 support for act init callback api. This prepares to handle extack support inside each specific act implementation. Based on work by David Ahern Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/act_api.h | 2 +- net/sched/act_api.c | 5 +++-- net/sched/act_bpf.c | 2 +- net/sched/act_connmark.c | 3 ++- net/sched/act_csum.c | 2 +- net/sched/act_gact.c | 2 +- net/sched/act_ife.c | 2 +- net/sched/act_ipt.c | 4 ++-- net/sched/act_mirred.c | 2 +- net/sched/act_nat.c | 3 ++- net/sched/act_pedit.c | 2 +- net/sched/act_police.c | 3 ++- net/sched/act_sample.c | 2 +- net/sched/act_simple.c | 2 +- net/sched/act_skbedit.c | 2 +- net/sched/act_skbmod.c | 2 +- net/sched/act_tunnel_key.c | 2 +- net/sched/act_vlan.c | 2 +- 18 files changed, 24 insertions(+), 20 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 41d95930ffbc..3717e0f2bb1b 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -90,7 +90,7 @@ struct tc_action_ops { int (*lookup)(struct net *net, struct tc_action **a, u32 index); int (*init)(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **act, int ovr, - int bind); + int bind, struct netlink_ext_ack *extack); int (*walk)(struct net *, struct sk_buff *, struct netlink_callback *, int, const struct tc_action_ops *); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 90ae3593ca2b..60dec7b762dd 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -680,9 +680,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, /* backward compatibility for policer */ if (name == NULL) - err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, ovr, bind); + err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, ovr, bind, + extack); else - err = a_o->init(net, nla, est, &a, ovr, bind); + err = a_o->init(net, nla, est, &a, ovr, bind, extack); if (err < 0) goto err_mod; diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index b3f2c15affa7..b3ebfa9598e2 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -272,7 +272,7 @@ static void tcf_bpf_prog_fill_cfg(const struct tcf_bpf *prog, static int tcf_bpf_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **act, - int replace, int bind) + int replace, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, bpf_net_id); struct nlattr *tb[TCA_ACT_BPF_MAX + 1]; diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 2b15ba84e0c8..20e0215360b5 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -96,7 +96,8 @@ static const struct nla_policy connmark_policy[TCA_CONNMARK_MAX + 1] = { static int tcf_connmark_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, connmark_net_id); struct nlattr *tb[TCA_CONNMARK_MAX + 1]; diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index b7ba9b06b147..3b8c48bb2683 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -46,7 +46,7 @@ static struct tc_action_ops act_csum_ops; static int tcf_csum_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, int ovr, - int bind) + int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, csum_net_id); struct tcf_csum_params *params_old, *params_new; diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index b56986d41c87..912f3398f1c1 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -56,7 +56,7 @@ static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = { static int tcf_gact_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, gact_net_id); struct nlattr *tb[TCA_GACT_MAX + 1]; diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 5954e992685a..e5127d400737 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -447,7 +447,7 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb, static int tcf_ife_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, ife_net_id); struct nlattr *tb[TCA_IFE_MAX + 1]; diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 06e380ae0928..6894cfa83863 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -193,7 +193,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, int ovr, - int bind) + int bind, struct netlink_ext_ack *extack) { return __tcf_ipt_init(net, ipt_net_id, nla, est, a, &act_ipt_ops, ovr, bind); @@ -201,7 +201,7 @@ static int tcf_ipt_init(struct net *net, struct nlattr *nla, static int tcf_xt_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, int ovr, - int bind) + int bind, struct netlink_ext_ack *extack) { return __tcf_ipt_init(net, xt_net_id, nla, est, a, &act_xt_ops, ovr, bind); diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index abcd5f12b913..7ccd4c71179f 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -69,7 +69,7 @@ static struct tc_action_ops act_mirred_ops; static int tcf_mirred_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, int ovr, - int bind) + int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, mirred_net_id); struct nlattr *tb[TCA_MIRRED_MAX + 1]; diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 98c6a4b2f523..7e5ebd7f52a6 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -37,7 +37,8 @@ static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = { }; static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est, - struct tc_action **a, int ovr, int bind) + struct tc_action **a, int ovr, int bind, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, nat_net_id); struct nlattr *tb[TCA_NAT_MAX + 1]; diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 349beaffb29e..bb2c35ed6f10 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -132,7 +132,7 @@ static int tcf_pedit_key_ex_dump(struct sk_buff *skb, static int tcf_pedit_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, pedit_net_id); struct nlattr *tb[TCA_PEDIT_MAX + 1]; diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 95d3c9097b25..6b6facbe251b 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -74,7 +74,8 @@ static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { static int tcf_act_police_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, + struct netlink_ext_ack *extack) { int ret = 0, err; struct nlattr *tb[TCA_POLICE_MAX + 1]; diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 1ba0df238756..f4579ceba1f6 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -37,7 +37,7 @@ static const struct nla_policy sample_policy[TCA_SAMPLE_MAX + 1] = { static int tcf_sample_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, int ovr, - int bind) + int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, sample_net_id); struct nlattr *tb[TCA_SAMPLE_MAX + 1]; diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 425eac11f6da..b0346347c5f0 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -79,7 +79,7 @@ static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { static int tcf_simp_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, simp_net_id); struct nlattr *tb[TCA_DEF_MAX + 1]; diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 5a3f691bb545..7651c9d2182d 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -66,7 +66,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = { static int tcf_skbedit_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbedit_net_id); struct nlattr *tb[TCA_SKBEDIT_MAX + 1]; diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index fa975262dbac..1266449aa8ea 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -84,7 +84,7 @@ static const struct nla_policy skbmod_policy[TCA_SKBMOD_MAX + 1] = { static int tcf_skbmod_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbmod_net_id); struct nlattr *tb[TCA_SKBMOD_MAX + 1]; diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 0e23aac09ad6..dde01eca7ed0 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -70,7 +70,7 @@ static const struct nla_policy tunnel_key_policy[TCA_TUNNEL_KEY_MAX + 1] = { static int tunnel_key_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); struct nlattr *tb[TCA_TUNNEL_KEY_MAX + 1]; diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index e1a1b3f3983a..6c387310b1b6 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -109,7 +109,7 @@ static const struct nla_policy vlan_policy[TCA_VLAN_MAX + 1] = { static int tcf_vlan_init(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **a, - int ovr, int bind) + int ovr, int bind, struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, vlan_net_id); struct nlattr *tb[TCA_VLAN_MAX + 1]; From patchwork Mon Feb 12 20:19:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872374 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="gLQ6Y7yv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8r2gCzz9sRm for ; Tue, 13 Feb 2018 07:20:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914AbeBLUUK (ORCPT ); Mon, 12 Feb 2018 15:20:10 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:38444 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347AbeBLUTp (ORCPT ); Mon, 12 Feb 2018 15:19:45 -0500 Received: by mail-it0-f67.google.com with SMTP id k6so8054572ita.3 for ; Mon, 12 Feb 2018 12:19:45 -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=OxRDNPAJgQQwffECirV7U/ljtRHPthLZr0DxXPesLwY=; b=gLQ6Y7yvhfzdEjXOuT8SYcsKMMRXdqT22OSGW3QIVMzAgBk/kuTsWLMTTXlb1/kw6n QUwKubn8clJ4pGRfMDMVP6nQMMbDm+VNtja+CQQ3zb0fRDkum6qyKak9H8mohQTLAyNe uFRq7cAxd48QA3vNeK12aVwqDwbobBDhd07ZToN8qmW6cH1L+iM1PvPBob3QxJYB8lBr ESxl6U0opAdYV8XBdZmupk4YDaV5L6Xo4NWzVyYCKSXAK7ehslTziZP4flAOPmylhMNd 3ka7SBeYK7cwMlay4NU4SmcT1DzCUi9z+Top6g1QGXKOQqnFr49fwwq+p6Drla52LLql +BQQ== 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=OxRDNPAJgQQwffECirV7U/ljtRHPthLZr0DxXPesLwY=; b=WkrRLBTS9eOLs21n3sRYK/MX+iae4TPpid5rVqvFcSMARgkxA8hHHzsT2PlTHSaC/Y 3bGU9sKx0bJnTDsj4K4o0Xr7Y+PMhh4waHXBH3tYLC0zvCaZNTPVS4diZeWEOT45oZOd 9AhYR56kOvHYB2iO3sc0yCfTfi5cZHQn2P0JYvROLwiJEtHjM7mW+SFQqdTy5iZj+Zaz GbmRQFaFsivT3l9bzJJNyG9wGfNbOUQotiA9V0PVSazeVm4BhEodDJWJt2d7/MSlPUiT IopIe988EopqNMgrpTIBX64p65EGH5gvfj1ZkTgCPezTc0xzG66mdYv+wzkaAr2F7PT0 0jMg== X-Gm-Message-State: APf1xPBEM9xDo7RCf9pH+DQ+S+BQ+Ee/NEB23pa2/Co8ADru3sSg44OO 3riCsOwimYa5te4NTOjjO2CyIg== X-Google-Smtp-Source: AH8x2263NO7MVBOG+NNEmkN/mh4j81/Nm1dzxBztXbrWTK7fo/JZeX4da/9pCY1j33cGMo3fHPTHbQ== X-Received: by 10.36.245.137 with SMTP id k131mr6815304ith.58.1518466784580; Mon, 12 Feb 2018 12:19:44 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:44 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 5/8] net: sched: act: add extack for lookup callback Date: Mon, 12 Feb 2018 15:19:08 -0500 Message-Id: <20180212201911.18704-6-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 support for act lookup callback api. This prepares to handle extack support inside each specific act implementation. Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/act_api.h | 3 ++- net/sched/act_api.c | 2 +- net/sched/act_bpf.c | 3 ++- net/sched/act_connmark.c | 3 ++- net/sched/act_csum.c | 3 ++- net/sched/act_gact.c | 3 ++- net/sched/act_ife.c | 3 ++- net/sched/act_ipt.c | 6 ++++-- net/sched/act_mirred.c | 3 ++- net/sched/act_nat.c | 3 ++- net/sched/act_pedit.c | 3 ++- net/sched/act_police.c | 3 ++- net/sched/act_sample.c | 3 ++- net/sched/act_simple.c | 3 ++- net/sched/act_skbedit.c | 3 ++- net/sched/act_skbmod.c | 3 ++- net/sched/act_tunnel_key.c | 3 ++- net/sched/act_vlan.c | 3 ++- 18 files changed, 37 insertions(+), 19 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 3717e0f2bb1b..0bd65db506ba 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -87,7 +87,8 @@ struct tc_action_ops { struct tcf_result *); int (*dump)(struct sk_buff *, struct tc_action *, int, int); void (*cleanup)(struct tc_action *); - int (*lookup)(struct net *net, struct tc_action **a, u32 index); + int (*lookup)(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack); int (*init)(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **act, int ovr, int bind, struct netlink_ext_ack *extack); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 60dec7b762dd..77093432ddc3 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -901,7 +901,7 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla, goto err_out; } err = -ENOENT; - if (ops->lookup(net, &a, index) == 0) + if (ops->lookup(net, &a, index, extack) == 0) goto err_mod; module_put(ops->owner); diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index b3ebfa9598e2..d9654b863347 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -374,7 +374,8 @@ static int tcf_bpf_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, bpf_net_id); diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 20e0215360b5..0504b7600fb6 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -184,7 +184,8 @@ static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, connmark_net_id); diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 3b8c48bb2683..bdd17b9ef034 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -638,7 +638,8 @@ static int tcf_csum_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, csum_net_id); diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 912f3398f1c1..e1e69e38f4b0 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -208,7 +208,8 @@ static int tcf_gact_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, gact_net_id); diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index e5127d400737..0b70fb0cc609 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -831,7 +831,8 @@ static int tcf_ife_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, ife_net_id); diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 6894cfa83863..f29af79a2d1f 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -310,7 +310,8 @@ static int tcf_ipt_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, ipt_net_id); @@ -358,7 +359,8 @@ static int tcf_xt_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, xt_net_id); diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 7ccd4c71179f..9980c6affb5e 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -272,7 +272,8 @@ static int tcf_mirred_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, mirred_net_id); diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 7e5ebd7f52a6..6f6d7667ef9a 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -285,7 +285,8 @@ static int tcf_nat_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, nat_net_id); diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index bb2c35ed6f10..308b2680a6d9 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -426,7 +426,8 @@ static int tcf_pedit_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, pedit_net_id); diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 6b6facbe251b..1292f880eab0 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -305,7 +305,8 @@ static int tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, return -1; } -static int tcf_police_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_police_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, police_net_id); diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index f4579ceba1f6..22379b2cfd1a 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -209,7 +209,8 @@ static int tcf_sample_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, sample_net_id); diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index b0346347c5f0..3ebf71470977 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -177,7 +177,8 @@ static int tcf_simp_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, simp_net_id); diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 7651c9d2182d..ff1970e14016 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -215,7 +215,8 @@ static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbedit_net_id); diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 1266449aa8ea..110d7c1f823d 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -239,7 +239,8 @@ static int tcf_skbmod_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbmod_net_id); diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index dde01eca7ed0..65a19928f1a9 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -298,7 +298,8 @@ static int tunnel_key_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index) +static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 6c387310b1b6..03dcbbc5ffd2 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -274,7 +274,8 @@ static int tcf_vlan_walker(struct net *net, struct sk_buff *skb, return tcf_generic_walker(tn, skb, cb, type, ops); } -static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index) +static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, vlan_net_id); From patchwork Mon Feb 12 20:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872372 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="oO6V3Aai"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8h143Hz9sRm for ; Tue, 13 Feb 2018 07:20:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753905AbeBLUUC (ORCPT ); Mon, 12 Feb 2018 15:20:02 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:44810 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753220AbeBLUTq (ORCPT ); Mon, 12 Feb 2018 15:19:46 -0500 Received: by mail-io0-f194.google.com with SMTP id z6so18663791iob.11 for ; Mon, 12 Feb 2018 12:19:46 -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=0nvcRZYg9vAP8+6ALGaUY/6MbQI7BimYTjk032DXR/E=; b=oO6V3AaiTh4GZLrjTrLBGPDDRyA4WxG7dl1Z2xKGmpGxgqbSQtNlkN6V7fZfdkrvSo icy3T5YC3NldhdhpWDKYfamHpaAWC/oRJRe77FHZDqTQxbVynJaSE3mgF33fWSywj3H5 MCuvXOojCVClzRr8OhOeiEgjxI6F3Mlwbl7GAjPnyJa16ZlSOynDjAbOeFI1FRmQU27v h5ZjYKXnBCHgjatTZ3jUVKwmY7TcHZFMPMdmn2pW8VUjDZejBUzTRVUMX1I6+d4COR/i /swx8LekcztvGQoXppAYcbNdHgL/WvAFlSWd3ddUHR9w75PC/hVDEnIlxrTUBBw0cY5d xMSA== 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=0nvcRZYg9vAP8+6ALGaUY/6MbQI7BimYTjk032DXR/E=; b=OgWJFkVAKsjFMcv6iHFCbhu34OrJBWeic3B3bus6i1I6LVx9O9d2pEEpDRL/4T4GWp 3qe0ks8FMGBaTcnURCX2jyfV7G/Unwb+BtgRjNUG3KxIDTkVcZXHOBGB8WkwQvJvtHxO di1dgahyC3j+FBpqow/zOdfmVuiB/j+k6d86/WyvnLAJ6ORPepB5H4xhoQH9Vni2AnWi GAa+DjMwFG3zGxMgg5h3G2Rlq4SkVB5/Y5Ve5GLNe6/BZ45gCmXsqowOZha9fsjZPI3l 7GE0W1VghtIw8AH/cvAMW8xaH0lxOMJq8jWhYymrGj7vSL3KDv5Rl80JzZK+OtTrY4gq 28gw== X-Gm-Message-State: APf1xPApGGPgMjid1Sbn7JtF0RAXWbyU1PLFdXleCZaOwZ9wG+SvxeqD dML394WHPz2wWbwHKoXE+Xt/+w== X-Google-Smtp-Source: AH8x226b+n+S5hXxdHEzJn4VNCLGs+FVYsgv2jj3sQmA8CSId60IadW2u9V0117z55zA3HG4ONNgbw== X-Received: by 10.107.34.199 with SMTP id i190mr15186290ioi.297.1518466785827; Mon, 12 Feb 2018 12:19:45 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:45 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 6/8] net: sched: act: add extack for walk callback Date: Mon, 12 Feb 2018 15:19:09 -0500 Message-Id: <20180212201911.18704-7-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 support for act walker callback api. This prepares to handle extack support inside each specific act implementation. Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/act_api.h | 3 ++- net/sched/act_api.c | 4 ++-- net/sched/act_bpf.c | 3 ++- net/sched/act_connmark.c | 3 ++- net/sched/act_csum.c | 3 ++- net/sched/act_gact.c | 3 ++- net/sched/act_ife.c | 3 ++- net/sched/act_ipt.c | 6 ++++-- net/sched/act_mirred.c | 3 ++- net/sched/act_nat.c | 3 ++- net/sched/act_pedit.c | 3 ++- net/sched/act_police.c | 3 ++- net/sched/act_sample.c | 3 ++- net/sched/act_simple.c | 3 ++- net/sched/act_skbedit.c | 3 ++- net/sched/act_skbmod.c | 3 ++- net/sched/act_tunnel_key.c | 3 ++- net/sched/act_vlan.c | 3 ++- 18 files changed, 38 insertions(+), 20 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 0bd65db506ba..ab3529255377 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -94,7 +94,8 @@ struct tc_action_ops { int bind, struct netlink_ext_ack *extack); int (*walk)(struct net *, struct sk_buff *, struct netlink_callback *, int, - const struct tc_action_ops *); + const struct tc_action_ops *, + struct netlink_ext_ack *); void (*stats_update)(struct tc_action *, u64, u32, u64); struct net_device *(*get_dev)(const struct tc_action *a); }; diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 77093432ddc3..1b30a29a2d9d 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -963,7 +963,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, goto out_module_put; } - err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops); + err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); if (err <= 0) goto out_module_put; @@ -1253,7 +1253,7 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) if (nest == NULL) goto out_module_put; - ret = a_o->walk(net, skb, cb, RTM_GETACTION, a_o); + ret = a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); if (ret < 0) goto out_module_put; diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index d9654b863347..7e01e2c710c4 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -367,7 +367,8 @@ static void tcf_bpf_cleanup(struct tc_action *act) static int tcf_bpf_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, bpf_net_id); diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 0504b7600fb6..cb722da0bb15 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -177,7 +177,8 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, connmark_net_id); diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index bdd17b9ef034..3e8efadb750f 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -631,7 +631,8 @@ static void tcf_csum_cleanup(struct tc_action *a) static int tcf_csum_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, csum_net_id); diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index e1e69e38f4b0..d96ebe4bb65a 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -201,7 +201,8 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_gact_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, gact_net_id); diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 0b70fb0cc609..b777e381e0dd 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -824,7 +824,8 @@ static int tcf_ife_act(struct sk_buff *skb, const struct tc_action *a, static int tcf_ife_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, ife_net_id); diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index f29af79a2d1f..f33a8cc5dee6 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -303,7 +303,8 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, static int tcf_ipt_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, ipt_net_id); @@ -352,7 +353,8 @@ static struct pernet_operations ipt_net_ops = { static int tcf_xt_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, xt_net_id); diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 9980c6affb5e..3dcd295ea6a7 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -265,7 +265,8 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, static int tcf_mirred_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, mirred_net_id); diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 6f6d7667ef9a..67243cdc0588 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -278,7 +278,8 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_nat_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, nat_net_id); diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 308b2680a6d9..6d6481f6bffa 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -419,7 +419,8 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_pedit_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, pedit_net_id); diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 1292f880eab0..ff803414a736 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -58,7 +58,8 @@ static struct tc_action_ops act_police_ops; static int tcf_act_police_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, police_net_id); diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 22379b2cfd1a..7a2b6a33f239 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -202,7 +202,8 @@ static int tcf_sample_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_sample_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, sample_net_id); diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 3ebf71470977..3f5474d20702 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -170,7 +170,8 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_simp_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, simp_net_id); diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index ff1970e14016..d99b6f1f5181 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -208,7 +208,8 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbedit_net_id); diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 110d7c1f823d..369ea85d0f02 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -232,7 +232,8 @@ static int tcf_skbmod_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_skbmod_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, skbmod_net_id); diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 65a19928f1a9..bced6fd00d43 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -291,7 +291,8 @@ static int tunnel_key_dump(struct sk_buff *skb, struct tc_action *a, static int tunnel_key_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 03dcbbc5ffd2..7cf409443d02 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -267,7 +267,8 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, static int tcf_vlan_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tc_action_net *tn = net_generic(net, vlan_net_id); From patchwork Mon Feb 12 20:19:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872369 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="OinfmviO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8R481hz9sRm for ; Tue, 13 Feb 2018 07:19:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753840AbeBLUTt (ORCPT ); Mon, 12 Feb 2018 15:19:49 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:33607 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752470AbeBLUTr (ORCPT ); Mon, 12 Feb 2018 15:19:47 -0500 Received: by mail-io0-f196.google.com with SMTP id n7so18711782iob.0 for ; Mon, 12 Feb 2018 12:19:47 -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=zTeLelTJP8h7mKe77yd/GkDxSWI5b1+2b2kfQSkig30=; b=OinfmviOTZ8sTU2CwZg4X5u0ukS/1DuMNmhmCk8TEmZBKiaX9gXOh9DpMsO3zo+53j nsF2aLGgvXlx0pTM5j+ifLiVilHHBZe4SV5TDcUplFETnO3m+FiQvpGrm1CiS85NjHOp ZIUfapQx3NwBIiYKmoOLmNmNqB6wNeM+JmXTyUwM4ffF3zvEFqIRYQ6zE8xWMuPznvi+ cERBOxNPkC/b+7dccD/U4z63yLYiVYbfoYJo9LiQjmmuSg6ajqAHDyQ7pPLeOi0qeBzB tw2IEKOHSaLLUCOZht1R7EARqXD8cgsb8tDDr9VD2EsEa5r4Ncub9QSvVPyStYMgxmUt ZsGw== 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=zTeLelTJP8h7mKe77yd/GkDxSWI5b1+2b2kfQSkig30=; b=uCMR/ZGqJ6ONOUt0EpQDxGvLb8I6i1Jr6TrjOOMjS/65udkkXDxJpwanF4b2TW8veq G4L2yMt9rCbEfjfqxCNW8vbudTS9UQms6/WVgVEAQ8z74zSwv2/gtnuQJ7pi6irjMYoC qPksDw5rvnIeeizx+hMjelaYrUjvtcDdLQLSFP3xOkq3bcKK4rzDjmsMyhw1RE4Tyvb8 ZBLCaa9TtmFtEsDc/to5zkVGeAyWEeLcx4hIXqwyYXpMfkSbhWxhyFNnE/DHvOxICsLK 6uXTVELwBCfjrz2GWuWT9e56nvZzHR5YdUaIT4h1/PGPU3pYzbNvu1QRA75BGmUFLdYe ARXw== X-Gm-Message-State: APf1xPBsqxwhwXv0gy+RgiUL0UwyxwJGlzDs98ttkZvWBA0bWTWlC5Uc 6kruHa5gd36Z9+/5OOO0PHw6DA== X-Google-Smtp-Source: AH8x225Lxjjx0nHLwp6oEsLufer+Dp71dpd+d6mbxLR7wql6/CQo0fcH6t2UQU1ldt3g//+GrXxxXg== X-Received: by 10.107.79.19 with SMTP id d19mr7513359iob.263.1518466786832; Mon, 12 Feb 2018 12:19:46 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:46 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 7/8] net: sched: act: handle extack in tcf_generic_walker Date: Mon, 12 Feb 2018 15:19:10 -0500 Message-Id: <20180212201911.18704-8-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 handling for a common used TC act function "tcf_generic_walker()" to add an extack message on failures. The tcf_generic_walker() function can fail if get a invalid command different than DEL and GET. The naming "action" here is wrong, the correct naming would be command. Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/act_api.h | 3 ++- net/sched/act_api.c | 6 ++++-- net/sched/act_bpf.c | 2 +- net/sched/act_connmark.c | 2 +- net/sched/act_csum.c | 2 +- net/sched/act_gact.c | 2 +- net/sched/act_ife.c | 2 +- net/sched/act_ipt.c | 4 ++-- net/sched/act_mirred.c | 2 +- net/sched/act_nat.c | 2 +- net/sched/act_pedit.c | 2 +- net/sched/act_police.c | 2 +- net/sched/act_sample.c | 2 +- net/sched/act_simple.c | 2 +- net/sched/act_skbedit.c | 2 +- net/sched/act_skbmod.c | 2 +- net/sched/act_tunnel_key.c | 2 +- net/sched/act_vlan.c | 2 +- 18 files changed, 23 insertions(+), 20 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index ab3529255377..9c2f22695025 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -140,7 +140,8 @@ static inline void tc_action_net_exit(struct list_head *net_list, int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops); + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack); int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index); bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a, int bind); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 1b30a29a2d9d..ab8431031d79 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -202,7 +202,8 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, struct netlink_callback *cb, int type, - const struct tc_action_ops *ops) + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tcf_idrinfo *idrinfo = tn->idrinfo; @@ -211,7 +212,8 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, } else if (type == RTM_GETACTION) { return tcf_dump_walker(idrinfo, skb, cb); } else { - WARN(1, "tcf_generic_walker: unknown action %d\n", type); + WARN(1, "tcf_generic_walker: unknown command %d\n", type); + NL_SET_ERR_MSG(extack, "tcf_generic_walker: unknown command\n"); return -EINVAL; } } diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index 7e01e2c710c4..cb3c5d403c88 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -372,7 +372,7 @@ static int tcf_bpf_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, bpf_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index cb722da0bb15..e4b880fa51fe 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -182,7 +182,7 @@ static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, connmark_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 3e8efadb750f..d5c2e528d150 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -636,7 +636,7 @@ static int tcf_csum_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, csum_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index d96ebe4bb65a..f072bcf33760 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -206,7 +206,7 @@ static int tcf_gact_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, gact_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index b777e381e0dd..a5994cf0512b 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -829,7 +829,7 @@ static int tcf_ife_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, ife_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index f33a8cc5dee6..9784629090ad 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -308,7 +308,7 @@ static int tcf_ipt_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, ipt_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index, @@ -358,7 +358,7 @@ static int tcf_xt_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, xt_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 3dcd295ea6a7..05c2ebe92eca 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -270,7 +270,7 @@ static int tcf_mirred_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, mirred_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 67243cdc0588..4b5848b6c252 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -283,7 +283,7 @@ static int tcf_nat_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, nat_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 6d6481f6bffa..094303c27c5e 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -424,7 +424,7 @@ static int tcf_pedit_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, pedit_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_police.c b/net/sched/act_police.c index ff803414a736..ff55bd6c7db0 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -63,7 +63,7 @@ static int tcf_act_police_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, police_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 7a2b6a33f239..9765145aaf40 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -207,7 +207,7 @@ static int tcf_sample_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, sample_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 3f5474d20702..8244e221fe4f 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -175,7 +175,7 @@ static int tcf_simp_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, simp_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index d99b6f1f5181..ddf69fc01bdf 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -213,7 +213,7 @@ static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, skbedit_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 369ea85d0f02..a406f191cb84 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -237,7 +237,7 @@ static int tcf_skbmod_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, skbmod_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index bced6fd00d43..41ff9d0e5c62 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -296,7 +296,7 @@ static int tunnel_key_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index, diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 7cf409443d02..71411a255f04 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -272,7 +272,7 @@ static int tcf_vlan_walker(struct net *net, struct sk_buff *skb, { struct tc_action_net *tn = net_generic(net, vlan_net_id); - return tcf_generic_walker(tn, skb, cb, type, ops); + return tcf_generic_walker(tn, skb, cb, type, ops, extack); } static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index, From patchwork Mon Feb 12 20:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 872370 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="ZcgxBGZ2"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgH8Y1vPPz9sRm for ; Tue, 13 Feb 2018 07:19:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753881AbeBLUTz (ORCPT ); Mon, 12 Feb 2018 15:19:55 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:33064 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbeBLUTs (ORCPT ); Mon, 12 Feb 2018 15:19:48 -0500 Received: by mail-it0-f68.google.com with SMTP id 140so903767iti.0 for ; Mon, 12 Feb 2018 12:19:48 -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=K4mgewPoXtI2uyd0il1wBdo/ph0LJCBgiERYpEHV3Ww=; b=ZcgxBGZ2wHxLbDbGhlcP1jp4C/3g+u0r7SU82vU14WxoUUWWi9KarA0imEY/Mo5bXS IE3mhOhtV4phwiT+Ln8DBwMdtL+wcvddlkIpQCToiZTvZVIN63/zON8oa5/+xZqpo6dg b8BqdAzQGCFshw0WTa1rlrLPvTG47HJsYAa3ZKOa4D2ilya9ri3S+hdKthdiVmMeTa77 l4RSKqnSi8xmpHB7OJpGd3FQnyYTAQ/a+j7JBRwlxPy6BcTXkNzHHEpjpkRCj479/vlB QY4sa7JZf45izIfanDmiYcKZarBJhdNLm4Qrhk5qILETYafP5bDP4v99ZTG1eakc1e+t vyRQ== 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=K4mgewPoXtI2uyd0il1wBdo/ph0LJCBgiERYpEHV3Ww=; b=sqWV13/DtUzzEN3yBMDCAYHSXgz3IM6H21rGEQ9XG7cB7ExoRiBsZO3mpnvZ1N9yJ3 05EXokDNHpWb4j7yMzKLro0woUyBxweKle8LJGGk8FBXawzRIMUODuvud4+vII7jFbaI /dbKy6zq4gmP99MykSdA2PHsEcedxZy9CA9hmfyKJGQdzu/rXVGDBaaMToWfXl3YfzTc Pty/teVZ5THi2HTx/nT0aCWc3DCVS6ZKjzL8IFKeCtRxskZGrATlWycAMBLLNE9ihYJW GqbYczkwARmfEPNam/2EGAZSyK9HwXjfyoSFJagTAKKcruuqXhLnYRJif99CCsGTpIj3 G3qQ== X-Gm-Message-State: APf1xPDt74DxCLP5L8F6NuSSMBiHEqNQOek1GToL5h11+yd3KPrNrKLG WOuY1DRlOghdrsFcBy5wjeH/Qg== X-Google-Smtp-Source: AH8x227rxE27kEudtyfxVrzBEq+yKOf8tq/Ag373h/NPGKSgsJmuAZ/Y2y5Pf1ZWyiXhmoRi4Cz+Nw== X-Received: by 10.36.237.130 with SMTP id r124mr7170978ith.45.1518466787878; Mon, 12 Feb 2018 12:19:47 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id s8sm8213236itb.39.2018.02.12.12.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:19:47 -0800 (PST) From: Alexander Aring To: davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, Alexander Aring , David Ahern Subject: [PATCH net-next 8/8] net: sched: act: mirred: add extack support Date: Mon, 12 Feb 2018 15:19:11 -0500 Message-Id: <20180212201911.18704-9-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180212201911.18704-1-aring@mojatatu.com> References: <20180212201911.18704-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 support for TC mirred action. Cc: David Ahern Signed-off-by: Alexander Aring --- net/sched/act_mirred.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 05c2ebe92eca..fd34015331ab 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, bool exists = false; int ret; - if (!nla) + if (!nla) { + NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); return -EINVAL; - ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, NULL); + } + ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack); if (ret < 0) return ret; - if (!tb[TCA_MIRRED_PARMS]) + if (!tb[TCA_MIRRED_PARMS]) { + NL_SET_ERR_MSG_MOD(extack, "Missing required mirred parameters"); return -EINVAL; + } parm = nla_data(tb[TCA_MIRRED_PARMS]); exists = tcf_idr_check(tn, parm->index, a, bind); @@ -102,6 +106,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, default: if (exists) tcf_idr_release(*a, bind); + NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option"); return -EINVAL; } if (parm->ifindex) { @@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, } if (!exists) { - if (!dev) + if (!dev) { + NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist"); return -EINVAL; + } ret = tcf_idr_create(tn, parm->index, est, a, &act_mirred_ops, bind, true); if (ret)