Received: by 10.192.165.148 with SMTP id m20csp2614479imm; Sun, 6 May 2018 20:09:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrI5n3JhVl/bsr+7LrY6Ydetpw1HEOeCpTVEKB0BLuSLIJ42qeKVSlRhClYdSbhgrOxqTMm X-Received: by 2002:a17:902:aa94:: with SMTP id d20-v6mr18203278plr.323.1525662547292; Sun, 06 May 2018 20:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525662547; cv=none; d=google.com; s=arc-20160816; b=hpAQgbyoEJ1ls59g03BV+HL3UbG+fmSBaWtOE6UJQ72uVA9EFOrmegnLwWza8SCLub EPw2rj4PWqD7yXvwvuEtoorK61onYFlhi1qE3kYOPZbqVqxceDfVrAIKE8XubUpjV1xZ isEiSm3yeQcQFLLh65M3129ZTvW7x+xJqnVyUJuztqXG/cPzhqd8mOSP7RGfZoCfFMhw lWKx+FNUL/BsltiNonOOpxK8gBLfUXA3vada0ij0E4SO2eSvhzu0EB6vxitaM5f8TWSE VNTJQ3ailludQB5kKlHoRtBxy5o2Dujzc9ZGUW+CNAAcn3MDntvFgHsQDtQ/BZ2n+EdB C0Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=nlJJ6m/REFsZjCQC1WLCoR8DAO2S97bT6K5P6RsXBmU=; b=TKD275RvB5t5Buo0YmoS4ymKgwqr40pZMWR5e8J67PCFhfjFyZqL39ree+hAxhOHEj muSOYtMd9deC0ycna+p6+gBSrZ6/r1W0gESxo4LU6MM+4u8+B35CKjARjpwCvmFe8pCQ MAxuC++LEEt21dunQeOm4SBH1ic32QKXtfllCky45fRyiw/IzJWERpwjxBxbdoq3C4QD ni68yG/prqjR3mYsQ/Nx0jVqksr3y+IVBmv8I9rMTR6lDrh7pr+77oYOobKPrJw8QU29 5unybqMMKXvjdORBy/u5OlkWbu8OzMeRHA36eMMrviBp05jfK366/3YUe0HHGwzDaTPt TDfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VKmcoJ27; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8-v6si20952864plo.306.2018.05.06.20.08.51; Sun, 06 May 2018 20:09:07 -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; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VKmcoJ27; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbeEGDIa (ORCPT + 99 others); Sun, 6 May 2018 23:08:30 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56209 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751874AbeEGDI3 (ORCPT ); Sun, 6 May 2018 23:08:29 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 149CE20E63; Sun, 6 May 2018 23:08:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 06 May 2018 23:08:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=nlJJ6m/REFsZjCQC1WLCoR8DAO2S9 7bT6K5P6RsXBmU=; b=VKmcoJ2767o+w6RZ8vpISE3+Ta9HV/rqmsJEyeKU+kjVu NV9ztwEu+zUrJhf4IzzFq1jQqpIjYi+rd/ddGs0UjwGATyBCFW7eOLx5l7EY4xJs ReKN6mvw0dxFNiFkvbdq1dhTjud6O28COdvigbOhE7f5XNgMQEe5zro6OIydAC8P uo7CWefbR8kgYvfuGo3yfO3Otd7JfcOSSp5bEwwAn5cxi2StNsW5byykS46gQJIX NitmmlMdvVgU6F1ih0vUf3Jcsu8uwfsClM17SLrc5NLGEA7Uc5sE5Xet5KQ3c8m6 yMadtDWKovZRC7b3IosY5UuqSYcY0lryQvvEXNOnA== X-ME-Sender: Received: from localhost (ppp121-44-245-79.bras2.syd2.internode.on.net [121.44.245.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 4555E10277; Sun, 6 May 2018 23:08:27 -0400 (EDT) Date: Mon, 7 May 2018 13:08:25 +1000 From: "Tobin C. Harding" To: Andrea Greco Cc: m.grzeschik@pengutronix.de, Andrea Greco , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 3/3] arcnet: com20020: Add ethtool support Message-ID: <20180507030825.GH4197@eros> References: <20180505213530.8294-1-andrea.greco.gapmilano@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180505213530.8294-1-andrea.greco.gapmilano@gmail.com> X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 05, 2018 at 11:35:29PM +0200, Andrea Greco wrote: > From: Andrea Greco > > Setup ethtols for export com20020 diag register > > Signed-off-by: Andrea Greco > --- > drivers/net/arcnet/com20020-isa.c | 1 + > drivers/net/arcnet/com20020-membus.c | 1 + > drivers/net/arcnet/com20020.c | 29 +++++++++++++++++++++++++++++ > drivers/net/arcnet/com20020.h | 1 + > drivers/net/arcnet/com20020_cs.c | 1 + > include/uapi/linux/if_arcnet.h | 6 ++++++ > 6 files changed, 39 insertions(+) > > diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c > index 38fa60ddaf2e..44ab6dcccb58 100644 > --- a/drivers/net/arcnet/com20020-isa.c > +++ b/drivers/net/arcnet/com20020-isa.c > @@ -154,6 +154,7 @@ static int __init com20020_init(void) > dev->dev_addr[0] = node; > > dev->netdev_ops = &com20020_netdev_ops; > + dev->ethtool_ops = &com20020_ethtool_ops; > > lp = netdev_priv(dev); > lp->backplane = backplane; > diff --git a/drivers/net/arcnet/com20020-membus.c b/drivers/net/arcnet/com20020-membus.c > index 6e4a2f3a84f7..9eead734a3cf 100644 > --- a/drivers/net/arcnet/com20020-membus.c > +++ b/drivers/net/arcnet/com20020-membus.c > @@ -91,6 +91,7 @@ static int com20020_probe(struct platform_device *pdev) > > dev = alloc_arcdev(NULL);// Let autoassign name arc%d > dev->netdev_ops = &com20020_netdev_ops; > + dev->ethtool_ops = &com20020_ethtool_ops; > lp = netdev_priv(dev); > > lp->card_flags = ARC_CAN_10MBIT;/* pretend all of them can 10Mbit */ > diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c > index abd32ed8ec9b..2089b45e81c8 100644 > --- a/drivers/net/arcnet/com20020.c > +++ b/drivers/net/arcnet/com20020.c > @@ -201,6 +201,34 @@ const struct net_device_ops com20020_netdev_ops = { > .ndo_set_rx_mode = com20020_set_mc_list, > }; > > +static int com20020_ethtool_regs_len(struct net_device *netdev) > +{ > + return sizeof(struct com20020_ethtool_regs); > +} > + > +static void com20020_ethtool_regs_read(struct net_device *dev, > + struct ethtool_regs *regs, void *p) > +{ > + struct arcnet_local *lp; > + struct com20020_ethtool_regs *com_reg; > + > + lp = netdev_priv(dev); > + memset(p, 0, sizeof(struct com20020_ethtool_regs)); perhaps: struct arcnet_local *lp = netdev_priv(dev); struct com20020_ethtool_regs *com_reg = p; memset(com_reg, 0, sizeof(*com_reg)); > + > + regs->version = 1; Should this function really have a side effect? If so, perhaps it could be commented. > + > + com_reg = p; > + > + com_reg->status = lp->hw.status(dev) & 0xFF; > + com_reg->diag_register = (lp->hw.status(dev) >> 8) & 0xFF; > + com_reg->reconf_count = lp->num_recons; > +} > + > +const struct ethtool_ops com20020_ethtool_ops = { > + .get_regs = com20020_ethtool_regs_read, > + .get_regs_len = com20020_ethtool_regs_len, > +}; > + Hope this helps, Tobin.