Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp702258imm; Wed, 4 Jul 2018 04:35:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf7wCUAD4z3vpscwr5AlqDPRjtvEU6cnUlzwqa2Oiot73e8SxgjHiEzS2GyhPJebYqwiTzb X-Received: by 2002:a65:41c6:: with SMTP id b6-v6mr1581653pgq.174.1530704135029; Wed, 04 Jul 2018 04:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530704135; cv=none; d=google.com; s=arc-20160816; b=L1rD1EEScJ4QziEXHOzG5AKHNPtY8dzxGL4Lc30qJRdoJQ9PCR7TLamxDnx+N4b+nP SkDbUVTm9zqAogVF/ZVLrMuxPCJt5KHoo8R4Z/RB5Tt4agIX1KrnGBdb+SDqSjc7Xrxs zv6k68BDx16n0W0pU2NIwICwpuumFiPr5eZxUZ/JXhQde83wQgfkqKU7I9Wglym8T8vt AdPMyr5HHa+cEKYDiivEtT0mG7vvb/GcYeQ6xFHcjK/dD0k6krgSNcrj6bJhkgqKuu2o ACp7hCEoqo6CU1Sg4envTKBSewmWetgJaekfbUL8yIpQSLGB8Lm+fmGiy8hrbIU5RO3q g01A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=7O2SMEagvIVVTCMqfDHH2lRTkqD6obHwmhjhof+xvZU=; b=boAFGy2t/vRlzZS7ukUnZMQPHGNNxMTIXfXuQHxvwPNsBu8jzNyugcXfN4dg1mOkwa NmaJtvQyS+Z7x1rtxsvBJO2h7jBlU+Cz/Tnw2cxyNCqYZF/0vRtt3LtvDr1Be2nTpG4L z8qyRKGhxkzXiJaGme94DPdIIZjwQM2C3Tztn3FrEJfoqPtPdsYb8oJ8VSrMcPT+6sq4 utkR7zaali/zGoBu+yweGKRji0Xqh+3a+tL0vjCBf2JDea9PZPbqWin/7qCIVUOX48Ud vY5UpT//oSX+wdYI6YkLheswX2d8DCqC2i63Ahs6nUWOBMY1e11BgUy2kI+X4Fyl5YGf hloQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si3680147plj.334.2018.07.04.04.35.20; Wed, 04 Jul 2018 04:35:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934239AbeGDLdd (ORCPT + 99 others); Wed, 4 Jul 2018 07:33:33 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:46023 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934102AbeGDLbX (ORCPT ); Wed, 4 Jul 2018 07:31:23 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Jul 2018 14:34:08 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (dev-l-vrt-136.mtl.labs.mlnx [10.134.136.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w64BVIAC031381; Wed, 4 Jul 2018 14:31:18 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id w64BVIBf024648; Wed, 4 Jul 2018 14:31:18 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id w64BVITo024647; Wed, 4 Jul 2018 14:31:18 +0300 From: Moshe Shemesh To: "David S. Miller" Cc: Vasundhara Volam , Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next 06/10] devlink: Add generic parameters internal_err_reset and max_macs Date: Wed, 4 Jul 2018 14:30:33 +0300 Message-Id: <1530703837-24563-7-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1530703837-24563-1-git-send-email-moshe@mellanox.com> References: <1530703837-24563-1-git-send-email-moshe@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add 2 first generic parameters to devlink configuration parameters set: internal_err_reset - When set enables reset device on internal errors. max_macs - max number of MACs per ETH port. Signed-off-by: Moshe Shemesh Signed-off-by: Jiri Pirko --- include/net/devlink.h | 31 +++++++++++++++++++++++++++++++ net/core/devlink.c | 14 +++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index 792edaa..a1c230d 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -356,12 +356,43 @@ struct devlink_param_item { }; enum devlink_param_generic_id { + DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET, + DEVLINK_PARAM_GENERIC_ID_MAX_MACS, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX, DEVLINK_PARAM_GENERIC_ID_MAX = __DEVLINK_PARAM_GENERIC_ID_MAX - 1, }; +#define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME "internal_error_reset" +#define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL + +#define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME "max_macs" +#define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE DEVLINK_PARAM_TYPE_U32 + +#define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ +{ \ + .id = DEVLINK_PARAM_GENERIC_ID_##_id, \ + .name = DEVLINK_PARAM_GENERIC_##_id##_NAME, \ + .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE, \ + .generic = true, \ + .supported_cmodes = _cmodes, \ + .get = _get, \ + .set = _set, \ + .validate = _validate, \ +} + +#define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate) \ +{ \ + .id = _id, \ + .name = _name, \ + .type = _type, \ + .supported_cmodes = _cmodes, \ + .get = _get, \ + .set = _set, \ + .validate = _validate, \ +} + struct devlink_ops { int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack); int (*port_type_set)(struct devlink_port *devlink_port, diff --git a/net/core/devlink.c b/net/core/devlink.c index 89d948f..5bbd0aa 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -2604,7 +2604,19 @@ static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info) return devlink->ops->reload(devlink, info->extack); } -static const struct devlink_param devlink_param_generic[] = {}; +static const struct devlink_param devlink_param_generic[] = { + { + .id = DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET, + .name = DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME, + .type = DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE, + }, + { + .id = DEVLINK_PARAM_GENERIC_ID_MAX_MACS, + .name = DEVLINK_PARAM_GENERIC_MAX_MACS_NAME, + .type = DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE, + }, + +}; static int devlink_param_generic_verify(const struct devlink_param *param) { -- 1.8.3.1