Received: by 10.192.165.148 with SMTP id m20csp1528127imm; Sat, 5 May 2018 14:37:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqya9JfsHcNH1NZ++kzC0Ro/sl9TFpl22tX3oFST97eqD9riFuMzFhVClMXKmQGulrwqy70 X-Received: by 2002:a63:af4b:: with SMTP id s11-v6mr10470532pgo.346.1525556220892; Sat, 05 May 2018 14:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525556220; cv=none; d=google.com; s=arc-20160816; b=eVn76gUtWL/qXvFoyzIPbGI4fqcXl2nUtTW/EFcONOXm+UaW7xlxFMzbhJvgAF2yKp g8L6uni1KTcTSwC3T4kArWHAKj9tbKFxMDr5Aqb0/zvW4Wjejtw5/6K8Eoavqo9BWRBn qWPJ1hGJVtOcdR1W5SoQoSQXAPwJuB4RT9AuFe8zFxV59Avsz3CeEfyr4y4ucPKN/cfw kDI+sucHN1bw1BZPsx88YPf53BEmEygDAVw7v57FIls6nX1VcjF5Y0tAA+dBPO/6zM6c lNklpwvFo0Uhiukxd5Y9ehxnbpJRm9tNgBzWtyo81GHbEkWNmYVQYsSQIKsX2YrcyKkR 36qg== 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=IVXxAdcdxZgWiTRcXStGfRi37q7Oy/6LDP/GSZfRhTI=; b=l4wnf0WSIHfiq/YFkaTp86ksmvJ82sA0tEUIjEhxtUk7aP8C822E6WdO1r/jBnDnLe CwcM5j2AQlvNu1r/Pu7zWhAbldhyG6KSV/+7EQ/5tpEbckrvlDth+2o6DtOAXBlVTDro pvT6ycSHAwKvOZZbMmG9h7Cff20RP/MQoN/irP7fUcWDJlu2lSGtYidzOX6Sk9VfNOzv fbgug9EJCCzfRhQPm02CdYe8cdfMvkM6aq8UmmXQiXaeK94RZ5dEpBm4bklqMMiXUezk 0HPChV0GYHOoIzzRSzKkXjJlmvhHPMXPyko1A8SOodruHaWUkeetF5idmkyz9oKXpgxl 8cmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cGsFD/iv; 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 n26-v6si15694530pgc.677.2018.05.05.14.36.46; Sat, 05 May 2018 14:37:00 -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=cGsFD/iv; 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 S1751903AbeEEVfk (ORCPT + 99 others); Sat, 5 May 2018 17:35:40 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38412 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbeEEVfi (ORCPT ); Sat, 5 May 2018 17:35:38 -0400 Received: by mail-wr0-f194.google.com with SMTP id 94-v6so22992168wrf.5; Sat, 05 May 2018 14:35:37 -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=IVXxAdcdxZgWiTRcXStGfRi37q7Oy/6LDP/GSZfRhTI=; b=cGsFD/ivTfTxJp6mlU8oiWnrr06aQLIUV2hgBs7zZZq14Z61Rhl9mo0L769v7xYW8H O5MOPQhSxvS6tse/Qm8s0JQhKac/Z1FG02ngrf26H6PU/TfF++rxiFtmDfYcLxu59B7g QoRcYt9PJy9+d+1Z+cLVhkb+xqA0udS3SZ2TVbFJU9lHk3C70zAND0P7gyNZzaTRAtnp yUI6o5yMVvsxPXm04ngpZWZf9rreTviU8dUqiM91OCctZ+JKhZBFUZ6uK60N4P1PHqqs UDbNjAQ7KAuEsUAvwLGtoeSi0oJK1Q0SKgw5o/ZspB17070fETrsR/nGXjjwQUyWNcBr 6x1A== 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=IVXxAdcdxZgWiTRcXStGfRi37q7Oy/6LDP/GSZfRhTI=; b=d5Ea8pmhP8rI17kzjr67oDBEUwNL9Kny1qIFDDGVwrCQdzlmfP+WHGBozLsEJCrVPk htmnA+mCQSTAjSAn4Ix9+UXXU824ZWSgEB0Pow+qxvIXZUGOfnJQd5kYt05x0guP0lrf FBLcXYsoYO14E6U1034TEblx5l2A0ZLdvosrJPXaNgwOY3h+hpA5PoJT7HTnSK1IZaIM w2RbqDnwrh14PQxZZKPMSlMz1jLRvxGL2rEhc0gq6jCIcxo9F01rpLlEkAZAM8oSENb9 OUEw8Gl3hExX48QqF2wrcf5p0NFkWQmr98xND3nlNfFC4jVsdIpHoxxrhQPcjV6TYr2A xzcA== X-Gm-Message-State: ALQs6tCscEclMamaEyqpjV+Tn/6gGXqcToMEinBa3a8PkVbCjBmPgf12 AYy2kARtnNhI0TElKN42J1RUUOwa X-Received: by 2002:adf:b18d:: with SMTP id q13-v6mr23833719wra.276.1525556137146; Sat, 05 May 2018 14:35:37 -0700 (PDT) Received: from noctune.station (net-93-71-68-108.cust.vodafonedsl.it. [93.71.68.108]) by smtp.gmail.com with ESMTPSA id x63sm6479154wma.25.2018.05.05.14.35.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 May 2018 14:35:36 -0700 (PDT) From: Andrea Greco To: m.grzeschik@pengutronix.de Cc: Andrea Greco , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/3] arcnet: com20020: Add ethtool support Date: Sat, 5 May 2018 23:35:29 +0200 Message-Id: <20180505213530.8294-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-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)); + + regs->version = 1; + + 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, +}; + /* Set up the struct net_device associated with this card. Called after * probing succeeds. */ @@ -402,6 +430,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