Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp671274iol; Sat, 11 Jun 2022 15:04:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkTib3uYF686JUydrPPV2elaboijByt02QRyLbR405bHI+e3L4XjMfq/dnVeLeYtyke3P4 X-Received: by 2002:a17:902:e0c2:b0:167:6128:e63d with SMTP id e2-20020a170902e0c200b001676128e63dmr40073900pla.16.1654985054175; Sat, 11 Jun 2022 15:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654985054; cv=none; d=google.com; s=arc-20160816; b=asYD0LTKmrcEzEMWckpZqSXrYN4bJwyOcTHdPT4BWTmqSw9R2y8KVWsKTIv9Os8JvB 2q5Lnp/h29Tz5VBXu5pSia3cYUHAsn3wnE2iP9jcNIlomkapDZlOFIe7rHA5aexnhIas TQJ8wWRCSIGJOfPl65SU6k5h7aGoMtGqrU/zLM6x5nsKPAVeKvyYlrPuyoDVnRMuFs+v 2dVpbjzfOPppzTEU16PRbm5+MgTn5R4QEVeMQrmfTZyILT6YTBgyTkgHd6bt1rb3dQ0S t/H7QtrpcOlA9SwNMQ9Am42fGJX/XNKjS8cUO9z2YhXUK3hb4IKic9SuTFpwzP/slRCI Tlsg== 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:dkim-signature; bh=hfPbQWxVdTCOJ0ARtfuxn4tIfyfSZbkVjOIz2CyS9yM=; b=PMW2RaHNgjjzwz5DAFHGJfYtFWKt2YSCWxqZ3gtS5PcCiowtrFi5FEyCgJ0L/dVkiO BJAoieHaF96XFiL0pKJ7S+tVUVZAyWz/lfi2Ni7vDGzeN72EOCzlAtm8rVd8K0WWPaS0 lSlROBCxuSufzJUzwPk6I5kiT9Zn17g4dT+JkfnW3r5UyUgq0Y82oBWUTWbK5viZtQkH QvRzDcavx23v1fNvO1xBDulrkNHxBhSgBHmoKP4YvisSslU9h2sVmLG7GjrLyHmw7QK0 +0AjoNZ8Jh5bZhK1R9Mj/ECXj8r0lEyDFwfVIL4NkF5GWWeWZyFkM45+vEHM6AcLhDkB UL6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XUz9K1yV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a63ef4c000000b003fbb430e4f8si4177253pgk.96.2022.06.11.15.03.52; Sat, 11 Jun 2022 15:04:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XUz9K1yV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232310AbiFKVoD (ORCPT + 99 others); Sat, 11 Jun 2022 17:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232250AbiFKVoC (ORCPT ); Sat, 11 Jun 2022 17:44:02 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA1AE57B3C for ; Sat, 11 Jun 2022 14:43:59 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id c4so3476572lfj.12 for ; Sat, 11 Jun 2022 14:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hfPbQWxVdTCOJ0ARtfuxn4tIfyfSZbkVjOIz2CyS9yM=; b=XUz9K1yVXlY0DRBDL7zr/EEftWakgFSk5edf9xSmnaFRtK8w9R41V9cED2gfDsxEy5 +ghpvR7TdhpG17i3HH6k/VZMJtPeqY1wECzCPja2oejHzdpgpCOW1Eb9esT/j76u2Ix7 8ES6QIHr1rMCVQL33PdI6tJCgOqKOBLQtjeOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hfPbQWxVdTCOJ0ARtfuxn4tIfyfSZbkVjOIz2CyS9yM=; b=L/ggXcWbdhaSCnY84kTXdKnuy1OyVxvgoYcGAsngCj0YNKNrGIAVqcJvNVw0pmErvj 2ZyU8o76R/pL9UuFf95lFc8pq2Ql3MfdrY0t4TvLP/4jwOWLCg9pMY+Vg3vNF1rJiNf7 Ogp1UYYDRIokL7P2LEUMrjrAVpxRobeJH1s0K9z4j2p/sq39svDRWEdStmBgcMeXovOI I4Zp1CbpNeq2M78TgkfYjYRjUfNK2zLbx7+A3QCiL56ZPyg3iulVp1dnVwGEkmtKQZI0 GglIhpq4EnWgeBEUpseak68wTISHnp/BXj9YZVKBNz5CnmX4Rjkr5o70vs7izjH7GwAB X+sA== X-Gm-Message-State: AOAM530gIm4pa7J4usF421R9StD2BcgKspTcIFmEYFNYMNkLQCBrna/W 3saDp9ZOCvidnlgR9bvYAFH9bYhu8ga1/GokIHQ6Fg== X-Received: by 2002:a19:431c:0:b0:479:2053:178e with SMTP id q28-20020a19431c000000b004792053178emr25009561lfa.117.1654983838112; Sat, 11 Jun 2022 14:43:58 -0700 (PDT) MIME-Version: 1.0 References: <20220607094752.1029295-1-dario.binacchi@amarulasolutions.com> <20220607094752.1029295-7-dario.binacchi@amarulasolutions.com> <20220609071636.6tbspftu3yclip55@pengutronix.de> In-Reply-To: <20220609071636.6tbspftu3yclip55@pengutronix.de> From: Dario Binacchi Date: Sat, 11 Jun 2022 23:43:47 +0200 Message-ID: Subject: Re: [RFC PATCH 06/13] can: slcan: allow to send commands to the adapter To: Marc Kleine-Budde Cc: linux-kernel@vger.kernel.org, Amarula patchwork , michael@amarulasolutions.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On Thu, Jun 9, 2022 at 9:16 AM Marc Kleine-Budde wrote: > > On 07.06.2022 11:47:45, Dario Binacchi wrote: > > This is a preparation patch for the upcoming support to change the > > bitrate via ip tool, reset the adapter error states via the ethtool API > > and, more generally, send commands to the adapter. > > > > Since some commands (e. g. setting the bitrate) will be sent before > > calling the open_candev(), the netif_running() will return false and so > > a new flag bit (i. e. SLF_XCMD) for serial transmission has to be added. > > > > Signed-off-by: Dario Binacchi > > I think this patch can be dropped, let me explain: > > You don't have to implement the do_set_bittiming callback. It's > perfectly OK to set the bitrate during the ndo_open callback after > open_candev(). I developed what you suggested (i. e. remove the SLF_XCMD bit and set the bitrate, as well as send the "F\r" and "O\r" commands, after calling the open_candev(), but now I can't send the close command ("C\r") during the ndo_stop() since netif_running() returns false. The CAN framework clears netif_running() before calling the ndo_stop(). IMHO the SLF_XCMD bit then becomes necessary to transmit the commands to the adapter from the ndo_open() and ndo_stop() routines. Any suggestions ? Thanks and regards, Dario > > regards, > Marc > > -- > Pengutronix e.K. | Marc Kleine-Budde | > Embedded Linux | https://www.pengutronix.de | > Vertretung West/Dortmund | Phone: +49-231-2826-924 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- Dario Binacchi Embedded Linux Developer dario.binacchi@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com