Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp27291rdb; Thu, 21 Dec 2023 01:34:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXG2EP8ucanXc7QLktucplc8SBGL6+uhhA4Hg4x46KSUJwQ+t12D7BtxMaNrh9E4JGFfp8 X-Received: by 2002:a17:902:b216:b0:1d0:a2b2:6b0d with SMTP id t22-20020a170902b21600b001d0a2b26b0dmr10956623plr.4.1703151282477; Thu, 21 Dec 2023 01:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703151282; cv=none; d=google.com; s=arc-20160816; b=Xf/DCWgtSm5YWKZ2ymqsTbJaETz4vxqUoYmYDQ5KT5cO6GE/bfg+T189KJKEz0rgmk X3elAt41EyqssVDy3WpJSvoHr6MZooLe4zDeLLxzI07vp9KaJnvTZ+AnCYMq9MXZMfVx dBCopqq0EZ75k+XjeLmANgtZNa5xxamr6PtTLnKx7N/CzSy16xxfUbnB1X4ArPZf1MYa Y8zlto/9+Usx3c0rEXxyAPUceG2AaWl+bIPwrfpi/2ishhjjeVcYXRXaJ0K536Kzl2sh M/svgRIKQEtadLmDw7flb3juQ2JWFOntBjBLXIJEzGwdrpXJgoS+mVErMYJcmya+1/lm 31JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=y1pQJ1UwDUcQ8/e6TvSExPJRrZtD1vKnuacCGjynOYg=; fh=Y/Zcr0YXYeEsWchgSSogMl8sJJcf/EqHGWMcPJ+i19E=; b=RYyoNVI7PVN5FOdYy+vdYdMV2i7piW2l8X3yp5Qh++Lo+lNi/l41fr1KioUIdB0Dan e3cY2WuhndV76OWKX9w8FM7bWIYiEBVXGtG107K5cQ1pg1dxBg/+PRf/44rODISmDUqt gqlkyJQkwMEJ5BirVPTJLg/B8v6Nj9E20Ff6NHhjZeQT973H2sgb1NUCsnIqg2bwuFhm V9LI6USjnQ0kCWDx3UXxrovxRGdn4fF4mSOgZw2F4x4BVWDKcj3tk5k9crcAKt5VWP2s doPiQSD0433ydby4SoIr/HAQdGtjBkIbS/rD5MwSZEcz9Yj8Ma6MvigQXUZLSKWSW+KB VsxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=KQ0VxQ73; spf=pass (google.com: domain of linux-kernel+bounces-8130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id me13-20020a170902fc4d00b001d3e11b91eesi1240862plb.375.2023.12.21.01.34.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 01:34:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=KQ0VxQ73; spf=pass (google.com: domain of linux-kernel+bounces-8130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 08D2E285981 for ; Thu, 21 Dec 2023 09:34:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D77D74E61D; Thu, 21 Dec 2023 09:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="KQ0VxQ73" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C61AF4CDE0; Thu, 21 Dec 2023 09:29:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BL6IACf018998; Thu, 21 Dec 2023 01:29:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=y1pQJ1UwDUcQ8/e6TvSExPJRrZtD1vKnuacCGjynOYg=; b=KQ0 VxQ73MBI5qWYPTKMf8Hz29t+5u9hWTvbNXFYaYtwVmTvd8BB94Lxty3EJonrNk/c 1Yft4Y4Z3aEmubwfXOJew2YtPIyXmfMd8msn4F4Crg8wSvu4H4FXZO9Vp88jxez4 z8srWP+cpKlWsQy75uRImujDDQhDMdyXAvMsruY8DvwPN75aaPS6LGBsyjC+KY9o Kp+3tyvA+72dlP9c9ED1YiBu+r6FfIPuEZmUaYzZHDGSKySdYkAVJzeGVGnwcf4t +uGSZa+QketL6kEGMLK3bjvxpoL10Fw1RTE9VThpkc0IMdX3KpaG+vbkn7Jdr5KL 3cGF3ENp/UMvA6/4XZA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3v4fyr147r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 21 Dec 2023 01:29:49 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 21 Dec 2023 01:29:48 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 21 Dec 2023 01:29:48 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id A71393F7048; Thu, 21 Dec 2023 01:29:47 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , , Veerasenareddy Burru , Satananda Burla , "David S. Miller" , Eric Dumazet Subject: [PATCH net-next v1 5/8] octeon_ep_vf: add support for ndo ops Date: Thu, 21 Dec 2023 01:28:41 -0800 Message-ID: <20231221092844.2885872-6-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231221092844.2885872-1-srasheed@marvell.com> References: <20231221092844.2885872-1-srasheed@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: XaniDbJPXIf50EXVPqg3HvEkBSdl5Mms X-Proofpoint-ORIG-GUID: XaniDbJPXIf50EXVPqg3HvEkBSdl5Mms X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 Add support for ndo ops to set MAC address, change MTU, get stats. Add control path support to set MAC address, change MTU, get stats, set speed, get and set link mode. Signed-off-by: Shinas Rasheed --- .../marvell/octeon_ep_vf/octep_vf_main.c | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c index 1bb621de5165..c29f99e8f121 100644 --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c @@ -188,6 +188,23 @@ static netdev_tx_t octep_vf_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } +int octep_vf_get_if_stats(struct octep_vf_device *oct) +{ + struct octep_vf_iface_rxtx_stats vf_stats; + int ret, size; + + memset(&vf_stats, 0, sizeof(struct octep_vf_iface_rxtx_stats)); + ret = octep_vf_mbox_bulk_read(oct, OCTEP_PFVF_MBOX_CMD_GET_STATS, + (u8 *)&vf_stats, &size); + if (!ret) { + memcpy(&oct->iface_rx_stats, &vf_stats.iface_rx_stats, + sizeof(struct octep_vf_iface_rx_stats)); + memcpy(&oct->iface_tx_stats, &vf_stats.iface_tx_stats, + sizeof(struct octep_vf_iface_tx_stats)); + } + return ret; +} + int octep_vf_get_link_info(struct octep_vf_device *oct) { int ret, size; @@ -201,6 +218,42 @@ int octep_vf_get_link_info(struct octep_vf_device *oct) return 0; } +/** + * octep_vf_get_stats64() - Get Octeon network device statistics. + * + * @netdev: kernel network device. + * @stats: pointer to stats structure to be filled in. + */ +static void octep_vf_get_stats64(struct net_device *netdev, + struct rtnl_link_stats64 *stats) +{ + struct octep_vf_device *oct = netdev_priv(netdev); + u64 tx_packets, tx_bytes, rx_packets, rx_bytes; + int q; + + tx_packets = 0; + tx_bytes = 0; + rx_packets = 0; + rx_bytes = 0; + for (q = 0; q < oct->num_oqs; q++) { + struct octep_vf_iq *iq = oct->iq[q]; + struct octep_vf_oq *oq = oct->oq[q]; + + tx_packets += iq->stats.instr_completed; + tx_bytes += iq->stats.bytes_sent; + rx_packets += oq->stats.packets; + rx_bytes += oq->stats.bytes; + } + stats->tx_packets = tx_packets; + stats->tx_bytes = tx_bytes; + stats->rx_packets = rx_packets; + stats->rx_bytes = rx_bytes; + if (!octep_vf_get_if_stats(oct)) { + stats->multicast = oct->iface_rx_stats.mcast_pkts; + stats->rx_errors = oct->iface_rx_stats.err_pkts; + } +} + /** * octep_vf_tx_timeout_task - work queue task to Handle Tx queue timeout. * @@ -313,6 +366,7 @@ static const struct net_device_ops octep_vf_netdev_ops = { .ndo_open = octep_vf_open, .ndo_stop = octep_vf_stop, .ndo_start_xmit = octep_vf_start_xmit, + .ndo_get_stats64 = octep_vf_get_stats64, .ndo_tx_timeout = octep_vf_tx_timeout, .ndo_set_mac_address = octep_vf_set_mac, .ndo_change_mtu = octep_vf_change_mtu, -- 2.25.1