Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp968106imm; Wed, 10 Oct 2018 07:10:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV6353Ak19TmfKk59hv62ysZi3bkbtTxo0aAs8/S+ZQmnpsDHtkIKVmVFcMAVZCiz+GgzRcFv X-Received: by 2002:a62:5698:: with SMTP id h24-v6mr8259831pfj.42.1539180637015; Wed, 10 Oct 2018 07:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539180636; cv=none; d=google.com; s=arc-20160816; b=Xco4/QeDqE3qpx208eK13vP9go074x8+R/f96htGJ0TFpLFa2PjEWPzzNErLdjA+An UOJxyWjdDm3PJjDiAlkBuede3fO5aE0oh+Ab0sclGjTmVxCl/kGM9wyA1acLM8s3A12A rQm28DZa/jC26yhCGwmiuh+GPFQLhh2JO3idYI2y3bEJmS11cgMto+xxp5rKlze9pB0Q /OkB7hWB//o9jp7ckFWoop++Rkx0eODiDqKDmifocoAvNC2N6/pXIpVE2o1OVuwoSvPy C+6cptJRXCnLNOA2yOSlUdHki/ao3ZlUvt1Vx0QLOg5qHiIwZGvgQXaDsZ6ey0DF6Mzc 6ftA== 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; bh=D28NaLlp9iHn2Rt2LFpS0IV+iP8UE5jApaUVwN1hCjQ=; b=ZypYwm2QEoyRX+8PAEQidnXJawfB9yev5y5Qo/5zMOMxExtNvnJHKbopAxYNoSyzKr AjxIcBsLaF8tWfudkNvm0wMEYXbqVYKBSlo56vuD3prDasKzCf+dBBiROCvoYsUrRzGz eLH6RY7PMZi9hbkWIyJKzxX2yJwzxkmKsTReeXSmAGSv+ZgMBqoXdBOK5feEo/f1uSLa 9vZ+kh64+a1YRaxGEv3lVICyaI/mr7sbVXfMVz1aEc9F7cJqcWrea/JxP71ThYnt0YzW Zl3vhZr5mqrSw+DvkTVpIJSxhbvuXTd9pvb46fQg6wbyndorsqri9TZ0P8piDDu4K3/q DIKg== 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 ay4-v6si24728470plb.410.2018.10.10.07.10.21; Wed, 10 Oct 2018 07:10:36 -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 S1727246AbeJJVby (ORCPT + 99 others); Wed, 10 Oct 2018 17:31:54 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:49411 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726920AbeJJVby (ORCPT ); Wed, 10 Oct 2018 17:31:54 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Oct 2018 15:14:44 +0200 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 w9AD9scw003289; Wed, 10 Oct 2018 16:09:54 +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 w9AD9rtK022237; Wed, 10 Oct 2018 16:09:53 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id w9AD9rSn022236; Wed, 10 Oct 2018 16:09:53 +0300 From: Moshe Shemesh To: "David S. Miller" Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net 2/3] devlink: Fix param cmode driverinit for string type Date: Wed, 10 Oct 2018 16:09:26 +0300 Message-Id: <1539176967-22172-3-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1539176967-22172-1-git-send-email-moshe@mellanox.com> References: <1539176967-22172-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 Driverinit configuration mode value is held by devlink to enable the driver fetch the value after reload command. In case the param type is string devlink should copy the value from driver string buffer to devlink string buffer on devlink_param_driverinit_value_set() and vice-versa on devlink_param_driverinit_value_get(). Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit value") Signed-off-by: Moshe Shemesh Acked-by: Jiri Pirko --- net/core/devlink.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index d808af7..1a0de16 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3105,7 +3105,10 @@ static int devlink_nl_cmd_param_set_doit(struct sk_buff *skb, return -EOPNOTSUPP; if (cmode == DEVLINK_PARAM_CMODE_DRIVERINIT) { - param_item->driverinit_value = value; + if (param->type == DEVLINK_PARAM_TYPE_STRING) + strcpy(param_item->driverinit_value.vstr, value.vstr); + else + param_item->driverinit_value = value; param_item->driverinit_value_valid = true; } else { if (!param->set) @@ -4545,7 +4548,10 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, DEVLINK_PARAM_CMODE_DRIVERINIT)) return -EOPNOTSUPP; - *init_val = param_item->driverinit_value; + if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING) + strcpy(init_val->vstr, param_item->driverinit_value.vstr); + else + *init_val = param_item->driverinit_value; return 0; } @@ -4576,7 +4582,10 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id, DEVLINK_PARAM_CMODE_DRIVERINIT)) return -EOPNOTSUPP; - param_item->driverinit_value = init_val; + if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING) + strcpy(param_item->driverinit_value.vstr, init_val.vstr); + else + param_item->driverinit_value = init_val; param_item->driverinit_value_valid = true; devlink_param_notify(devlink, param_item, DEVLINK_CMD_PARAM_NEW); -- 1.8.3.1