Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp186620rdb; Sun, 28 Jan 2024 21:03:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHUsbnim/a9Vi/1lrSTSWTxx9PUU9phJbFX3HvRMvcTdBACfgk4djV7xVOYE6vk2HRZB5J X-Received: by 2002:ac8:7c4e:0:b0:42a:7e99:48b with SMTP id o14-20020ac87c4e000000b0042a7e99048bmr6676921qtv.127.1706504638518; Sun, 28 Jan 2024 21:03:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706504638; cv=pass; d=google.com; s=arc-20160816; b=UJp/8NjmzXdQs64xUhDbpzrC7N1fAJ9bMYtanE6fG8VKEZEjDhNpKh7qWWUitdw/Rf kvHuFBqNiY40RJm1LC4zo77l5bT1/o7pVmyjam6SgW8KjQi25PQeqSY4D/jVmfkGf7Wj /4yINQmNCcktUGPBUaGnKV/0JLr0oquvOumc2Krd6Lebxyc3633q1LA9MOVdQKPLvJHw V98kqSXVO2pwKlJdOb6kHQqUruC93PrhtCVxJuWkQ+JAYy0umjh3d8D9llsJi9yiK7ne ejhgRU9Ir25pnC3SuaA68Z7zMy12InmN9vYx7JPC3szkDL2MuW8V7c0/flKP7e9G4Ppt x8FA== ARC-Message-Signature: i=2; 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=ZOvduTOyCNrJIKJ8Qa9RNSmLbNmT5aw5W2vZ3KoliyQ=; fh=Y/Zcr0YXYeEsWchgSSogMl8sJJcf/EqHGWMcPJ+i19E=; b=qUKphOjpL3iUSqYCv2LS+gtEmg5iE9KFKOc+5DaHudEfaH6u5dLMnE9O6U1geL4TM0 f/AIcuYHdSGms5CrBOEDJMaPV4CPbzpbQTljOKkS0vG5sY4VOhcL/4Rum1wa+qr5aatP MXGuHB2vQLKB8Ma9PaLs10ujEEnRGOsEEC0fzsSR31IT0iJk0Lb6IHr/cUAZwKsU1N9k L2/hmshpk2oNYJGM03BgW9SBEeld9YZzgXPmHpwU3MyeLXF9qj1kSryn5Bm4IeASsBmt W55BiE5XPJlvsCsYdgEyS4TV/TLkHlDZkwEmZF6FWlWxW/42EGGB4z98s+VkgNaQ18bS BxrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=JxKT68lB; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-42167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42167-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j10-20020ac8440a000000b0042a87d1cc8dsi5107241qtn.237.2024.01.28.21.03.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 21:03:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=JxKT68lB; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-42167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42167-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2F0871C21C60 for ; Mon, 29 Jan 2024 05:03:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D93845973; Mon, 29 Jan 2024 05:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="JxKT68lB" 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 C275F3C49C; Mon, 29 Jan 2024 05:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706504615; cv=none; b=WquncPy4JA1ColKiWru+SWqLw6AEGHQxlebjMWYBHI3S3UiyRgg3kLOKnrCDw3IHuUiYAk0QzYUj6aRXpqejmc617evjeA+442ZJwCS8rMeTEk2Vd6uOkVKR+ItvmmkTcA9f9hMwMb5lDeAOYhq1Kr9y49Dd2AlQvE7P69f+Gro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706504615; c=relaxed/simple; bh=j1q4tB+oOQYzR1/x6opmItWuKWDj32zm3XHggC6iVEc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E5et+sO1ipBArzINH34KWt+imHeR2OLnIXvLJOoyzRwfOUODVxEmQ7SFp7Y+Sey4C0faACEHdEZz+chDffbyAJ9+Ptkka7xAECNwYFEtRvvJW7RcIp8ARQEWatkGSEH/A3NLSzWGTjKm0QdevSPHKXZpKtlbKVMfS3cYmPfQcW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=JxKT68lB; arc=none smtp.client-ip=67.231.148.174 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 40T4KEj9027114; Sun, 28 Jan 2024 21:03:26 -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=ZOvduTOyCNrJIKJ8Qa9RNSmLbNmT5aw5W2vZ3KoliyQ=; b=JxK T68lBtY2bT+5pnFPi/7Bnmu7O6RB4yYE9gtvvwsJ17+wpyC6QqG6Tjom+yZ0/C/g evC1OwJKIUrhim3PuClpE1WiTBSK1Q8gixxUf038mFHKdNfl3WKaeIhc6KpxKTwj 61uI8g2HsRjgcoySwSkqwCix/wDSGngVZH6rrIsHRm7Qu7HOo7vQ/XRI6VCObfgI +m6stqdmzUt3oOuNambwTeMR+V+8VCzaA2c7QVrQVzrG7Lk4N5Hihu3BMJJ/TB86 pnukbgavxAaxqRlZTDUgKEwyKdHBMxhRxBSmD5yEhr0t4Y6UAIHhFFMTMTwKs0fw GTshs22gIfoZZjoAsAA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vx4vr82dg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 28 Jan 2024 21:03:26 -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; Sun, 28 Jan 2024 21:03:25 -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; Sun, 28 Jan 2024 21:03:24 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id A14733F703F; Sun, 28 Jan 2024 21:03:24 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , , Veerasenareddy Burru , Satananda Burla , "David S. Miller" , Eric Dumazet Subject: [PATCH net-next v5 5/8] octeon_ep_vf: add support for ndo ops Date: Sun, 28 Jan 2024 21:02:51 -0800 Message-ID: <20240129050254.3047778-6-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240129050254.3047778-1-srasheed@marvell.com> References: <20240129050254.3047778-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-ORIG-GUID: pFQG03xlhIJ8uPBjJ_4l9AtQVxMHh5G7 X-Proofpoint-GUID: pFQG03xlhIJ8uPBjJ_4l9AtQVxMHh5G7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-29_02,2024-01-25_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 --- V5: - No changes V4: https://lore.kernel.org/all/20240108124213.2966536-6-srasheed@marvell.com/ - Provide more stats in ndo_get_stats64 such as tx_dropped, rx_dropped etc. V3: https://lore.kernel.org/all/20240105203823.2953604-6-srasheed@marvell.com/ - No changes V2: https://lore.kernel.org/all/20231223134000.2906144-6-srasheed@marvell.com/ - No changes V1: https://lore.kernel.org/all/20231221092844.2885872-6-srasheed@marvell.com/ .../marvell/octeon_ep_vf/octep_vf_main.c | 58 +++++++++++++++++++ 1 file changed, 58 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 51f92c8223e8..13084cac9ce0 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 @@ -187,6 +187,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; @@ -200,6 +217,46 @@ 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; + stats->rx_dropped = oct->iface_rx_stats.dropped_pkts_fifo_full + + oct->iface_rx_stats.err_pkts; + stats->rx_missed_errors = oct->iface_rx_stats.dropped_pkts_fifo_full; + stats->tx_dropped = oct->iface_tx_stats.dropped; + } +} + /** * octep_vf_tx_timeout_task - work queue task to Handle Tx queue timeout. * @@ -312,6 +369,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