From patchwork Thu Feb 21 10:55:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 1046053 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="LZr3DdG8"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 444s8M6XBRz9s4Y for ; Thu, 21 Feb 2019 22:05:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726184AbfBULFi (ORCPT ); Thu, 21 Feb 2019 06:05:38 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44013 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbfBULFi (ORCPT ); Thu, 21 Feb 2019 06:05:38 -0500 Received: by mail-wr1-f68.google.com with SMTP id d17so15055032wre.10 for ; Thu, 21 Feb 2019 03:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=hXTNgA5P7h3JIpqAKzJov68tvseJ39Hm5gmtMzNrpFo=; b=LZr3DdG87VFa/vdcAQtGT1ZIYrviBP86iC2or3rEps5tO5ly/0quW/zY2++FuUt4ea xb0S1OOpVPup4FzQd+tktspcYneuBj87nLJd4oLcggIkHmWcs1lyhaAeeUSRw69/ypsl sQMAmrSy2CEsC38FwMIj/SJx9As1BEk+q92t68Y+o2apFGMLoHjT17JrNZzXk04UFhXC oZcFhIgdnF3Tw8unakIQgXjCMlPFM++A58qtDQ/74Notm3xjl/fRA3RQcPcXUGOiP+hk I4MWKwqubxoW40ta8PSm7xKL5THLJbsYlOMqD5tZjH9ZH+sH6pyg9hZZ8Yd4/OIRtn24 HXbg== 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; bh=hXTNgA5P7h3JIpqAKzJov68tvseJ39Hm5gmtMzNrpFo=; b=sRXtac0bJ3s0wbwkPDYiP2/xAiFypwtXbpZvYLtJkaAe0uLaVmKgcHIprIhHXmpEQs zfqGpfznczHRa0JaYn2Py8OS7lGZYtq3S9bxPFusyO27ar6x0TCwavqq17lRlujDyGQN /yPFdPSmWz8YshSj3OwEncuFrnnUPW8q3P9I8OzALMNwLogbMoQXiQspujrmCp7HyVdJ cU6bIH61A5qYoZ1fQjBQ2Z2KgiZxY94JTP+mcaMrpcrJLdWvaFP3UDKAXT2yRB6ZBsIX aBuMF2inpxr9MnJLF+klrlhdt0sIDjERMUITeqp+OpBW5ROjYTNVO/LShrnbHZZsIaPG Kt6g== X-Gm-Message-State: AHQUAuYh4N2zxB/Zh79VOvRCj4dBORJ5NjO3ByAvHYUceQKL7SKAJsbj C3MdFwDgGribzZeaujdhV6CvKK/opdQ= X-Google-Smtp-Source: AHgI3IbhpAdKiwilvcnFjw4Z+Br3wNCnyYhvd9Sj9h3gs0H43kE2EMRG667guvd3DYrJthqwJp3MgA== X-Received: by 2002:a5d:4a8a:: with SMTP id o10mr28109661wrq.189.1550747136310; Thu, 21 Feb 2019 03:05:36 -0800 (PST) Received: from localhost (ip-89-102-139-73.net.upcbroadband.cz. [89.102.139.73]) by smtp.gmail.com with ESMTPSA id k2sm5789418wmj.45.2019.02.21.03.05.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Feb 2019 03:05:35 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: stephen@networkplumber.org, dsahern@gmail.com, mlxsw@mellanox.com Subject: [patch iproute2 v2] devlink: relax dpipe table show dependency on resources Date: Thu, 21 Feb 2019 11:55:56 +0100 Message-Id: <20190221105556.1315-1-jiri@resnulli.us> X-Mailer: git-send-email 2.14.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Dpipe table show command has a depencency on getting resources. If resource get command is not supported by the driver, dpipe table show fails. However, resource is only additional information in dpipe table show output. So relax the dependency and let the dpipe tables be shown even if resources get command fails. Fixes: ead180274caf ("devlink: Add support for resource/dpipe relation") Signed-off-by: Jiri Pirko --- v1->v2: - removed "!!" --- devlink/devlink.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index 3651e90c1159..cced8d619f9f 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -4351,7 +4351,8 @@ static int dpipe_table_show(struct dpipe_ctx *ctx, struct nlattr *nl) size = mnl_attr_get_u32(nla_table[DEVLINK_ATTR_DPIPE_TABLE_SIZE]); counters_enabled = !!mnl_attr_get_u8(nla_table[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED]); - resource_valid = !!nla_table[DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID]; + resource_valid = nla_table[DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID] && + ctx->resources; if (resource_valid) { table->resource_id = mnl_attr_get_u64(nla_table[DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID]); table->resource_valid = true; @@ -4467,12 +4468,9 @@ static int cmd_dpipe_table_show(struct dl *dl) dl_opts_put(nlh, dl); err = _mnlg_socket_sndrcv(dl->nlg, nlh, cmd_resource_dump_cb, &resource_ctx); - if (err) { - pr_err("error get resources %s\n", strerror(resource_ctx.err)); - goto err_resource_dump; - } + if (!err) + dpipe_ctx.resources = resource_ctx.resources; - dpipe_ctx.resources = resource_ctx.resources; flags = NLM_F_REQUEST | NLM_F_ACK; nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_DPIPE_TABLE_GET, flags); dl_opts_put(nlh, dl); @@ -4485,8 +4483,6 @@ static int cmd_dpipe_table_show(struct dl *dl) dpipe_ctx_fini(&dpipe_ctx); return 0; -err_resource_dump: - resource_ctx_fini(&resource_ctx); err_resource_ctx_init: err_headers_get: dpipe_ctx_fini(&dpipe_ctx);