Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp688319pxy; Sat, 14 Aug 2021 20:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjWBg6z2LpfmJCwjJKalHql5/kRSnGjL9pQ9j7idNRKdBLWRENol2AxeEDzFTcChFoM3PY X-Received: by 2002:a17:906:1901:: with SMTP id a1mr10097744eje.129.1628998821744; Sat, 14 Aug 2021 20:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628998821; cv=none; d=google.com; s=arc-20160816; b=ryqPpIwZrDb4EcqtxikgO7uK9Q+feNBBc6N66769MTMSG7W+dA5nBFWzJUPdi48E51 +2JBL0/0MbNWpJpk2bOn4teHIT6BqsN9pwjpSvKOUCf1GCyF4Lu0HRya/drM+zyyOMKP Qef16IzxHgVOYZvJ/X+p2x6I3A6v2lHoVi3Q9fgIv8E6LG2fUiAlgJJ92vFpqiz4MIAh MyWM+3QhRMW1bO6CW8ITV106OFLNB1If5Uo8xDbHfPJtcJi9W2oMEWTo0mJcie3KuUr8 wVr3UcrifOQ6bQ69FVvFzM8+cXP7Hm20OpBX9p6C/iRS0sncJHurMVcKfjrTgw33ShOB 0j3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=OcuDfg9eRzXnneI6MaY2x1oxJrEEIkpSAcdBbgk2tSY=; b=jlC6JLaGLWtUtwrRcYmoTYTarphFe/pFT+RJ+Y/BLBuMQ5nZ4tyBmt36vSBvEW3lbw Xq78n1fTAN54n0ttebVQed7nBNPkI/sw2WewLsKXlUVLsz9okzhWzxrKx4bzbul3pAVH tcMJXGRAoRq2V2zmNq0B4CR9XBlq915KfRQObZFdXUkiRpp2zVQjCwmIbsLdqRbq1hJT BgqnkWJSP0dnVgYxOCv5at5hJK14pZHi/qahTar6/wT8EzONI6MGXzLGc56VxS/VRN+y IGi2B7F9Eq70QoP/uVTrRrXhSTl6NEos7GbwyecLXFvq5q0/aGp0m+rxWt2OLmKHd2Y4 P8rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc10si7244464ejc.528.2021.08.14.20.39.54; Sat, 14 Aug 2021 20:40:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235530AbhHODio (ORCPT + 99 others); Sat, 14 Aug 2021 23:38:44 -0400 Received: from mail-lj1-f171.google.com ([209.85.208.171]:41879 "EHLO mail-lj1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233848AbhHODim (ORCPT ); Sat, 14 Aug 2021 23:38:42 -0400 Received: by mail-lj1-f171.google.com with SMTP id h9so21850099ljq.8; Sat, 14 Aug 2021 20:38:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OcuDfg9eRzXnneI6MaY2x1oxJrEEIkpSAcdBbgk2tSY=; b=qs/R5JUgNf/cW5nfGxtjuxQKrCroMShkOv8KTP+yDD5L/jjy8H7ZVw2M9XIcz1fyv1 OKrW3tZUi73yawDUrCUWXSZ5zsD9Re1a+adE+RWgnmtOPsOVsNxiiu2wEOP2RHpnHTGQ jz2sAKO+Uc89Hr4zzPPK2ZvUttXTizYOmGlm9s45xySBL9oVumWnaCyzBADvfeLUfoNw Z+5h3JFzidRSd9oPY4RZy5IRssl2AfZPzSsi/hLG75+BKoKBk7fh/YqLEapMHbGQm4JO iRhdvKrpcCj8ni64UdUn42fEbGndBKTGttRLFi0ppF+c2lezEDRcQOrxV35GeTmaLNpt l5cA== X-Gm-Message-State: AOAM531yXN1egb5Q7HPs3DARkHZWG5OU/Ngp6dhHtbeJBOJQ7kxNyX/I UWziW5jC6PEeVP+vg3h11OTbb65Z41WisXftRYU= X-Received: by 2002:a2e:a4ba:: with SMTP id g26mr1317635ljm.254.1628998692179; Sat, 14 Aug 2021 20:38:12 -0700 (PDT) MIME-Version: 1.0 References: <20210814091750.73931-1-mailhol.vincent@wanadoo.fr> <20210814091750.73931-6-mailhol.vincent@wanadoo.fr> <20210814111243.biquurwkyzmhmsad@pengutronix.de> In-Reply-To: <20210814111243.biquurwkyzmhmsad@pengutronix.de> From: Vincent MAILHOL Date: Sun, 15 Aug 2021 12:38:00 +0900 Message-ID: Subject: Re: [PATCH v4 5/7] can: netlink: add interface for CAN-FD Transmitter Delay Compensation (TDC) To: Marc Kleine-Budde Cc: linux-can , =?UTF-8?Q?Stefan_M=C3=A4tje?= , netdev , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat. 14 Aug 2021 at 20:12, Marc Kleine-Budde wrote: > On 14.08.2021 18:17:48, Vincent Mailhol wrote: > [...] > > > static int can_changelink(struct net_device *dev, struct nlattr *tb[], > > struct nlattr *data[], > > struct netlink_ext_ack *extack) > > { > > struct can_priv *priv = netdev_priv(dev); > > + u32 tdc_mask = 0; > > int err; > > > > /* We need synchronization with dev->stop() */ > > @@ -107,6 +179,7 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[], > > struct can_ctrlmode *cm; > > u32 ctrlstatic; > > u32 maskedflags; > > + u32 tdc_flags; > > > > /* Do not allow changing controller mode while running */ > > if (dev->flags & IFF_UP) > > @@ -138,7 +211,18 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[], > > dev->mtu = CAN_MTU; > > memset(&priv->data_bittiming, 0, > > sizeof(priv->data_bittiming)); > > + memset(&priv->tdc, 0, sizeof(priv->tdc)); > > + priv->ctrlmode &= ~CAN_CTRLMODE_TDC_MASK; > > } > > + > > + tdc_flags = cm->flags & CAN_CTRLMODE_TDC_MASK; > > + /* CAN_CTRLMODE_TDC_{AUTO,MANUAL} are mutually exclusive */ > > + if (tdc_flags == CAN_CTRLMODE_TDC_MASK) > > + return -EOPNOTSUPP; > > + /* If one of CAN_CTRLMODE_TDC_* is set then TDC must be set */ > > + if (tdc_flags && !data[IFLA_CAN_TDC]) > > + return -EOPNOTSUPP; > > These don't need information form the can_priv, right? So these checks > can be moved to can_validate()? ACK. Actually, this comment applies not only to can_changelink() but also to can_tdc_changelink(). I just sent a v5 where I made sure to move all the checks that do not rely on can_priv to can_validate(). Yours sincerely, Vincent