From patchwork Fri Oct 5 10:25:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Russkikh X-Patchwork-Id: 10627847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4376112B for ; Fri, 5 Oct 2018 10:25:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A83BE28FD5 for ; Fri, 5 Oct 2018 10:25:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C87128FEF; Fri, 5 Oct 2018 10:25:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2089128FD5 for ; Fri, 5 Oct 2018 10:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728507AbeJERXl (ORCPT ); Fri, 5 Oct 2018 13:23:41 -0400 Received: from mail-bl2nam02on0081.outbound.protection.outlook.com ([104.47.38.81]:6901 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728461AbeJERXl (ORCPT ); Fri, 5 Oct 2018 13:23:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7q7E8TrfQ8YAYT0d+6kDmbOD3M2hZf7Wo0iZaiEcfg4=; b=Omxe19GxKpmsFrjoVk0hiKOJ9lpJErFOuTH/qZSClCYZEub+mBpQpE0RosXH+g2R2TjGNMm3MDNcnbT9ey7mDvYvzS4+zysv8Q7QhQ0bDC5grF29FMJ6s0CJ1DFsZ1PO7T+bPpfg59HwnzwxlXg6GQ9IPd/o5p+3jQrR7EuhKZ4= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1641.namprd07.prod.outlook.com (10.162.110.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Fri, 5 Oct 2018 10:25:22 +0000 Received: from BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17]) by BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17%2]) with mapi id 15.20.1207.021; Fri, 5 Oct 2018 10:25:22 +0000 From: Igor Russkikh To: "David S . Miller" CC: "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" , Igor Russkikh , Dmitry Bezrukov Subject: [PATCH net-next 17/19] net: usb: aqc111: Initialize ethtool_ops structure Thread-Topic: [PATCH net-next 17/19] net: usb: aqc111: Initialize ethtool_ops structure Thread-Index: AQHUXJW5nmmA1rI/PEewWNP2H0d+Nw== Date: Fri, 5 Oct 2018 10:25:22 +0000 Message-ID: <26309478ca61ae4163acb455d62021cf6801c29a.1538734658.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0602CA0024.eurprd06.prod.outlook.com (2603:10a6:203:a3::34) To BY1PR0701MB1660.namprd07.prod.outlook.com (2a01:111:e400:522a::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BY1PR0701MB1641;6:0Kj+dtbCtF1cjKWP9wySSr6rwy3s63LYs2NzEWrVvDwcRc2oKW0po8TjpclEodKnrPPsRv9+ECJnBbHpovyw6qbllU0uJAjE0EcU+HVsXGPdkym4bK0e8ealc6G6p5/YSzjcfUL+BIMtp4Qfh50w6nbTW6fWJAHtvPgdjl+Q0dFlV3bvRVH3CzdWM25XAFqpssfwZl/Wj5uUq/gf39dcX4Ves2QNTpwv4xkmFIdcohMs7pzzH0/8qTQ4sqjnK8r/IYs8UX4bVZ8E2IHUK6MoNHpeFDfIDctiYkA0GylOiA6LnFU3swfcRVedHHF4WO6GP9vnfxqcIX91u8EwZ5Q7o51noLCbze63XdfFWi9SteJZBx573DkFU06fFvnBUfeE/XzwM45nd4uvyMNPuOdk0w2RlGk+9RoiUeq1PDcB/ueQLd5JpDbzlYlCZrcU6gW26tcVquaj7ovapnsbpYdUFg==;5:FolEIefrepl/M3tSMbi92sjUIo2dfdPJZulB89dgFO4OxI2jntqnOrByVZ7YpDClv2B6IU8SSXT4Q13PErQjRKyUacnL1xLzS0bepvJAiv9QTkT/fqYMrfCei/rfr2qCPFhlnxjSRC4hBeVckAjChEIHBttaMyndZuPRDNRLFFQ=;7:jvAEMJvXsOUqambi1sl4CSPKK5h/DjH95Ndnr0voeBPLzm2XULNjtYu7MC/V6xwNSSs9pjIgw+cnPodNDuFHfGVu50w/WzFB/yx62JYIr54XSvoHHEtN6iYu3GZhSGqk4OQyBX01idJXMyp1rqIn3k1lwsOQ1P8nsYsz4n8FMlUrlEmGPaeudCAKyZqR01ZFbgFOLaTXr8AahjNju/goluvdspbPVDWTvTFr8CVbGBlc53isvqlI0P9o7XdwuUkF x-ms-office365-filtering-correlation-id: 35eb8814-7704-4037-3a07-08d62aacdb41 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BY1PR0701MB1641; x-ms-traffictypediagnostic: BY1PR0701MB1641: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:BY1PR0701MB1641;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1641; x-forefront-prvs: 0816F1D86E x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(366004)(346002)(136003)(39850400004)(396003)(199004)(189003)(575784001)(81166006)(81156014)(6436002)(86362001)(8676002)(118296001)(316002)(14454004)(6512007)(8936002)(66066001)(256004)(386003)(2900100001)(11346002)(2906002)(6506007)(6486002)(52116002)(36756003)(107886003)(3846002)(486006)(53936002)(71190400001)(476003)(99286004)(105586002)(97736004)(26005)(44832011)(2616005)(68736007)(54906003)(186003)(5660300001)(5250100002)(71200400001)(446003)(76176011)(7736002)(4326008)(102836004)(106356001)(305945005)(478600001)(6116002)(6916009)(72206003)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:BY1PR0701MB1641;H:BY1PR0701MB1660.namprd07.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 27aEAk9PWx3mnhS7CSBxhgsOyxShPN6X7XziIQOe7GoyEwAGZgnSNZXu5d/hEUKxKzOrDMu6kmKQee2xAXw7uNirwPPTKrWB9yRfucR9oUVRKNazy/UVjNn+8eHcvgsobMWAhO2DR8Rj16gL8DoBNJQzBizG1wXXhD6R0cIcHo1buUxtSzBz7vM3MaRSmE1ummY5OJLOzUnbWJbPS6yen29n07lCkoXNZCjlrvxH5Xrg4KRN8H2GACmVVB8D01CbFE+EUvMaegR7cFADcNwBCeoy/GYK+7Caryj6mntcaVFMzWsHKVQqRiEEGTLVspI+j+9wjIxwgdg4Vkq6xYAUNtsIHFbUaBgPGy8s7TafVmU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35eb8814-7704-4037-3a07-08d62aacdb41 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2018 10:25:22.6511 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1641 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dmitry Bezrukov Implement get_drvinfo, set/get_msglevel, get_link callbacks Signed-off-by: Dmitry Bezrukov Signed-off-by: Igor Russkikh --- drivers/net/usb/aqc111.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c index 9908b0a04da6..ade2b60b4811 100644 --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -18,6 +19,9 @@ #include "aqc111.h" +#define DRIVER_VERSION "1.0.0.0" +#define DRIVER_NAME "Aquantia AQtion USB to 5GbE" + static int __aqc111_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data, int nopm) { @@ -170,6 +174,24 @@ static int aq_mdio_write_cmd(struct usbnet *dev, u16 value, u16 index, return aqc111_write_cmd(dev, AQ_PHY_CMD, value, index, size, data); } +static void aqc111_get_drvinfo(struct net_device *net, + struct ethtool_drvinfo *info) +{ + struct usbnet *dev = netdev_priv(net); + struct aqc111_data *aqc111_data = (struct aqc111_data *)dev->data[0]; + + /* Inherit standard device info */ + usbnet_get_drvinfo(net, info); + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); + strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); + snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u.%u", + aqc111_data->fw_ver.major, + aqc111_data->fw_ver.minor, + aqc111_data->fw_ver.rev); + info->eedump_len = 0x00; + info->regdump_len = 0x00; +} + static void aqc111_set_phy_speed_fw_iface(struct usbnet *dev, struct aqc111_data *aqc111_data) { @@ -286,6 +308,13 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed) aqc111_set_phy_speed_fw_iface(dev, aqc111_data); } +static const struct ethtool_ops aqc111_ethtool_ops = { + .get_drvinfo = aqc111_get_drvinfo, + .get_msglevel = usbnet_get_msglevel, + .set_msglevel = usbnet_set_msglevel, + .get_link = ethtool_op_get_link, +}; + static int aqc111_change_mtu(struct net_device *net, int new_mtu) { struct usbnet *dev = netdev_priv(net); @@ -605,6 +634,7 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf) dev->net->needed_tailroom += AQ_TX_HEADER_SIZE; dev->net->netdev_ops = &aqc111_netdev_ops; + dev->net->ethtool_ops = &aqc111_ethtool_ops; if (usb_device_no_sg_constraint(dev->udev)) dev->can_dma_sg = 1;