From patchwork Mon Dec 18 22:45:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 850469 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="1MSUKauI"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z0x2k5jcgz9s4s for ; Tue, 19 Dec 2017 09:45:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938350AbdLRWps (ORCPT ); Mon, 18 Dec 2017 17:45:48 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:34671 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936416AbdLRWpk (ORCPT ); Mon, 18 Dec 2017 17:45:40 -0500 Received: by mail-io0-f194.google.com with SMTP id f18so6484767ioh.1 for ; Mon, 18 Dec 2017 14:45:39 -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=x88Sv7+bTqW+X1L2h4kF1pwier5xJpbhmlgtoMcahPE=; b=1MSUKauISFUvyB/rimi5mDHO+DfH1OdF2dUl41YV+qqvx7mIRqnBEJy29gcwFcUpYj wgdnSi7/mpVtYOgzna83uk0xX32P2pyPY8mxV6GYMFUC4j4r4SIxpmT9w1h29R4t+XJZ oWZA11QDFTT6yaXrKRiKdzjiTMOUNSDNEKrxPG381J1EIRlLCORkkGlmHdf45mVVI2mO iZaoxJC5nj7HDAjUx7sahN9+ExQFAT/fXOnUkD6pC3027oIbGcDTY6pR8hyVgT6VXGY8 HcXI2FwBaj+MCiLJ9U41JT8xYX3I/x8FCco5b4RtvKEs8W0bwLUosHJdALsRfIEjYMmd EVwQ== 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=x88Sv7+bTqW+X1L2h4kF1pwier5xJpbhmlgtoMcahPE=; b=MzRc5mxQd0dg82gU2WlmTdT6wVSRQMGtS0as08V/0ks7CE8fbDk9vvaEqe/+REogdy Kt+cPTXdOTZonphm5e0eEPctPChPsHyfpUd8oVmUl+VXoHPtJzxguJqNeY/iG1DEqIVn a6KEI9YeOyBmeHAskaLEIsDLr+F0po+RcMqi0duFPigiJRPfYuu6LrCnujKPCV4ooSu4 AAV97TlLiMQpWUBLUfhfBoOyBaJVgDvF1iJeDF5jVrh9PJrk3Xt2mR27k1ewxxk9i79q Q4boPrNOp0cWIPCsjF/shu+NqTo1wwZdse4rPZxt7xzdq5R24QlZrzd9XUUnkW6fWD+x nL7g== X-Gm-Message-State: AKGB3mLEUlYYeF47gRD7W/FiNNQpWQraKvamoBs2XKEKTgEeu7uI9uh7 Jkt0tLBSyH40PXv7y+gysDiVjg== X-Google-Smtp-Source: ACJfBoudcAb+uzZoblj8/Q96rcsMFjD0xlzEgoL+SFdlmgeruNvCLzEaNcRhkWLPNBZ+iYi/g1eK6g== X-Received: by 10.107.175.208 with SMTP id p77mr1722748ioo.30.1513637139435; Mon, 18 Dec 2017 14:45:39 -0800 (PST) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id o71sm210867itb.28.2017.12.18.14.45.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 14:45:39 -0800 (PST) From: Alexander Aring To: jhs@mojatatu.com Cc: xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, netdev@vger.kernel.org, kernel@mojatatu.com, Alexander Aring , David Ahern Subject: [PATCHv3 net-next 10/14] net: sch: api: add extack support in qdisc_alloc Date: Mon, 18 Dec 2017 17:45:09 -0500 Message-Id: <20171218224513.29836-11-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171218224513.29836-1-aring@mojatatu.com> References: <20171218224513.29836-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 the function qdisc_alloc which is a common used function in the tc subsystem. Callers which are interested in the receiving error can assign extack to get a more detailed information why qdisc_alloc failed. Cc: David Ahern Signed-off-by: Alexander Aring --- include/net/sch_generic.h | 3 ++- net/sched/sch_api.c | 2 +- net/sched/sch_generic.c | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 2ea04863ea34..1dbfbec00050 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -470,7 +470,8 @@ void qdisc_destroy(struct Qdisc *qdisc); void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n, unsigned int len); struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, - const struct Qdisc_ops *ops); + const struct Qdisc_ops *ops, + struct netlink_ext_ack *extack); struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, const struct Qdisc_ops *ops, u32 parentid); void __qdisc_calculate_pkt_len(struct sk_buff *skb, diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index a58459569f35..fd3960ff0fe4 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1050,7 +1050,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev, goto err_out; } - sch = qdisc_alloc(dev_queue, ops); + sch = qdisc_alloc(dev_queue, ops, extack); if (IS_ERR(sch)) { err = PTR_ERR(sch); goto err_out2; diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 5cdafe88b902..01457b27d36e 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -749,7 +749,8 @@ static struct lock_class_key qdisc_tx_busylock; static struct lock_class_key qdisc_running_key; struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, - const struct Qdisc_ops *ops) + const struct Qdisc_ops *ops, + struct netlink_ext_ack *extack) { void *p; struct Qdisc *sch; @@ -758,6 +759,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, struct net_device *dev; if (!dev_queue) { + NL_SET_ERR_MSG(extack, "No device queue given"); err = -EINVAL; goto errout; } @@ -829,7 +831,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, if (!try_module_get(ops->owner)) return NULL; - sch = qdisc_alloc(dev_queue, ops); + sch = qdisc_alloc(dev_queue, ops, NULL); if (IS_ERR(sch)) { module_put(ops->owner); return NULL;