Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3263683imm; Thu, 17 May 2018 06:09:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoXe0f/BLUr+JT9Gd16gwSnqE6XA5Vi4/7y4vf7OFkBKBPuDNON+zFY5Gn7r19VqbwL5qZ/ X-Received: by 2002:a63:be01:: with SMTP id l1-v6mr4015494pgf.267.1526562565603; Thu, 17 May 2018 06:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526562565; cv=none; d=google.com; s=arc-20160816; b=zmATcpw9yQ7Kxxs1SyXcR0xzIul0bIPHF51bdQZuLTZgb9xz9y+qrnH0GKtnCkcrup HovkW8F8cg6RCN8O9AmpAg5O4wimkj7IrGK9QNXY6nPLll231ttPd7ZcUmypbgUTmMln xuv85mNdl69ndZ6MuhE+O9zJAC4Xw+LtBIt75PUbqFp3aoP8GhmIlsPKrz/mO1Eow30s 3MALbv7052Yx1jZHb18froFmGvNbonct3Yjkjaxwt8GJC4uMBltUERFkExISt3HdnE0B KpUZEPfqtM+gv1z2A048Y+Mbxa1FERwIQDJb71nbA31oEoEnR2ell6EZRhL6RAWoEHUf xA6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=y6EH4jpM2SLoZ5pumIur2U6TdKz2+0DP0+Y5r9SokVY=; b=bFXQ+wvHsbsPfED2gU6oixowgKEBtIJiw1PMKWeyh5h1PtcMN+wtPF8FNsg9/BldWK KCC++9fM5dO6WapdGSnD1w+NL85eBnMUarHEhBnN6f2D91+cKm0U+fZ/XQaAs71/TTEO 4A7VPCVitGM6jjTPVE+COyryARx6uM1ONRa1zZYcUMuDQgLz6z3cDCgkjMOTy9SXs7Ya epE7+BlaszpPh1+HW1e89O7LaycI7zfYMU5wk0VOnzct5Kzcta4PKhV3LDSYVDW+b8Ze jcb9CHa053N17NwgnVg+d0jwe2h2aE4+aT2MS+2wdiAz0KQAB+Zy3raoq7kIjlRgxLsB UZ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ukcr7fiM; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12-v6si5132831plt.233.2018.05.17.06.09.11; Thu, 17 May 2018 06:09:25 -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=@gmail.com header.s=20161025 header.b=Ukcr7fiM; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbeEQNIM (ORCPT + 99 others); Thu, 17 May 2018 09:08:12 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:39994 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751468AbeEQNIK (ORCPT ); Thu, 17 May 2018 09:08:10 -0400 Received: by mail-wm0-f66.google.com with SMTP id j5-v6so8968467wme.5; Thu, 17 May 2018 06:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=y6EH4jpM2SLoZ5pumIur2U6TdKz2+0DP0+Y5r9SokVY=; b=Ukcr7fiMWP/yfS4wgVHwMvaPFAZC1GJT1TzC5wAHJUSQ/VYDYg0gYWEEZ+1ieg5k5V zMjpTw+pyG1dinYCGUFJ4apN1hQMnBBbz0pCAnyNoxQacdcO7o43TzlJgkaubTtFfMzO mt1ozW9IrGbfrw1RFVh1pyP1xBgcKTyiRQqKMNYXrgiOjlQtkzldxjmsjSIoM5OhRRsR OjAzGBYVjtBcOnRSJyx/3aVip3eDFsF5p1vaXeXpSdEsKF6pg+yGyFYEPzc4v/TEfHc6 cP7p6db0OmgMdsjW8v1Bf2UBldiyBjuOWy6Tm3I2hbav/askCV/wq4glfQLjFbszIVlI /aQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y6EH4jpM2SLoZ5pumIur2U6TdKz2+0DP0+Y5r9SokVY=; b=fGddoAFjvZFFI9nD7qAMRhM44RFYLCUXVMJXJgS214acWsT1LUlWf70zk6cV0T5fuX ksMXLJH/0uBsXFI/ON6NcW99KK1VI3Krg2/0d3dpWSlGQuGQZc7UWFqCsq1GEWHihA3z 5LL8RABMJ02RI70/xPGNy6DI/qiQvFZouWdLVkzsQwa7BgTteeXJXyl0hiuBx0SV9p4l DDO44z8cCbtLisLYieWdERA69DPrOHU5q1yETLa4WKB8xYq8yLVaHGtWmLLHOAa99Vso cfeKAHhbvhlTN8Mw+eco9xWHxO8MSW0tCeWZ1MxOA1ciGLorLPphqB/7+NjGWsy02NiX GHuQ== X-Gm-Message-State: ALKqPwfkk8RGVqJe3Rp/U9xaKa+/kjPDihNRAQ0PEOyCA+LdpNaa48QP t+7HNp3UU1+QFB/61E8XW2A= X-Received: by 2002:a1c:4105:: with SMTP id o5-v6mr1660009wma.91.1526562488811; Thu, 17 May 2018 06:08:08 -0700 (PDT) Received: from localhost.localdomain (83-103-103-194.ip.fastwebnet.it. [83.103.103.194]) by smtp.gmail.com with ESMTPSA id k126-v6sm8713876wmd.45.2018.05.17.06.08.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 06:08:07 -0700 (PDT) From: Andrea Greco To: tobin@apporbit.com Cc: andrea.greco.gapmilano@gmail.com, Andrea Greco , Michael Grzeschik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] arcnet: com20020: Add ethtool support Date: Thu, 17 May 2018 15:07:57 +0200 Message-Id: <20180517130757.2895-1-andrea.greco.gapmilano@gmail.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrea Greco Setup ethtols for export com20020 diag register Signed-off-by: Andrea Greco --- drivers/net/arcnet/com20020-io.c | 1 + drivers/net/arcnet/com20020-isa.c | 1 + drivers/net/arcnet/com20020.c | 24 ++++++++++++++++++++++++ drivers/net/arcnet/com20020.h | 1 + drivers/net/arcnet/com20020_cs.c | 1 + include/uapi/linux/if_arcnet.h | 6 ++++++ 6 files changed, 34 insertions(+) diff --git a/drivers/net/arcnet/com20020-io.c b/drivers/net/arcnet/com20020-io.c index fce458242193..0d4355bcd873 100644 --- a/drivers/net/arcnet/com20020-io.c +++ b/drivers/net/arcnet/com20020-io.c @@ -183,6 +183,7 @@ static int com20020_probe(struct platform_device *pdev) dev = alloc_arcdev(NULL); dev->netdev_ops = &com20020_netdev_ops; + dev->ethtool_ops = &com20020_ethtool_ops; lp = netdev_priv(dev); lp->card_flags = ARC_CAN_10MBIT; 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.c b/drivers/net/arcnet/com20020.c index f1de02f05305..02dd93a18e53 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -201,6 +201,29 @@ 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 = netdev_priv(dev); + struct com20020_ethtool_regs *com_reg = p; + + memset(p, 0, sizeof(struct com20020_ethtool_regs)); + + 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, +}; + /* Set up the struct net_device associated with this card. Called after * probing succeeds. */ @@ -402,6 +425,7 @@ static void com20020_set_mc_list(struct net_device *dev) EXPORT_SYMBOL(com20020_check); EXPORT_SYMBOL(com20020_found); EXPORT_SYMBOL(com20020_netdev_ops); +EXPORT_SYMBOL(com20020_ethtool_ops); #endif MODULE_LICENSE("GPL"); diff --git a/drivers/net/arcnet/com20020.h b/drivers/net/arcnet/com20020.h index 0bcc5d0a6903..a1024c8f8a1f 100644 --- a/drivers/net/arcnet/com20020.h +++ b/drivers/net/arcnet/com20020.h @@ -31,6 +31,7 @@ int com20020_check(struct net_device *dev); int com20020_found(struct net_device *dev, int shared); extern const struct net_device_ops com20020_netdev_ops; +extern const struct ethtool_ops com20020_ethtool_ops; /* The number of low I/O ports used by the card. */ #define ARCNET_TOTAL_SIZE 8 diff --git a/drivers/net/arcnet/com20020_cs.c b/drivers/net/arcnet/com20020_cs.c index cf607ffcf358..ae64f436fd54 100644 --- a/drivers/net/arcnet/com20020_cs.c +++ b/drivers/net/arcnet/com20020_cs.c @@ -233,6 +233,7 @@ static int com20020_config(struct pcmcia_device *link) } dev->irq = link->irq; + dev->ethtool_ops = &com20020_ethtool_ops; ret = pcmcia_enable_device(link); if (ret) diff --git a/include/uapi/linux/if_arcnet.h b/include/uapi/linux/if_arcnet.h index 683878036d76..790c0fa7386d 100644 --- a/include/uapi/linux/if_arcnet.h +++ b/include/uapi/linux/if_arcnet.h @@ -127,4 +127,10 @@ struct archdr { } soft; }; +struct com20020_ethtool_regs { + __u8 status; + __u8 diag_register; + __u32 reconf_count; +}; + #endif /* _LINUX_IF_ARCNET_H */ -- 2.14.3