From patchwork Fri Jan 5 20:38:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 185534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6457857dyb; Fri, 5 Jan 2024 12:39:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjt9P6hbVo3I+zBpUCgpcRn2pp247hsbjdFxlZjSRath1fepDIYw8ZLtHT3FDnD/WtTKyk X-Received: by 2002:a05:622a:355:b0:428:36b1:8f7f with SMTP id r21-20020a05622a035500b0042836b18f7fmr4112138qtw.0.1704487165389; Fri, 05 Jan 2024 12:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704487165; cv=none; d=google.com; s=arc-20160816; b=JKkxTo+0eoioT4pzACowlatNyILZpa6rh8OeoKT1hIH0mcahAKq2n33gF27WerQdW+ R2A7pvqTJQtsslso3NWYU0AGtgNjhhvWfSxtys4NH+HXNQ6ElRGW/g7vrhp7Zns37UY/ FWqRAIX5JPsN1i3GWppbSXx/xG1urRNXdeiqErK39PC5jK2j7t5gP+WT713BQX+jTV7r qQQKPLMeRIfmitPUQHHp31nKwhgovppipioUHc11YNeEBdn8+XL9LSZaCm/whAbxCb/F Ht4vlgu4ReB3L1TMhfc0zYtyok9phraMsfV8iU3nJyWPJ63lbeU22fHgLbaX4aj9wqPi gH1w== 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=WanHoCGn2FkkaCWsFdREZ6VNRHR/RlLjYJnYh5Hy9vs=; fh=Y/Zcr0YXYeEsWchgSSogMl8sJJcf/EqHGWMcPJ+i19E=; b=pzG0alhTkvn3XjrFu0bviWIn6Vm0kHlM+J0N4MEqL21EtT3dPFbbqkWiqfeNYGDZKW wc9qhJ+E3PATCSC54Xv3MQ3PgS9DqWZDdpGd97WiwEZx9mwkjXByMJDAGOIqYUD260I/ bstWZHqadnaC6nDBeFMDni8pRPRmq9T+YbbPQ3+oQfg7LgpJWm/f7PM+dulh2m2Kucxn I7mbx9vo2qPxA84uC+4VX+oYNvOtRMKAcopn8HaAC+1LbsQTWnr23BjjrKUTvk5tE7hC b56PNaxWUpr0TTDHNZ50wj6twrbEqUPnmktfUjBqn/jFfNkmcRM1suLnAtQ4KroKjGaI kbqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BPbJQJuU; spf=pass (google.com: domain of linux-kernel+bounces-18333-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18333-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d13-20020a05622a05cd00b0042540184032si2615633qtb.336.2024.01.05.12.39.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 12:39:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18333-ouuuleilei=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=BPbJQJuU; spf=pass (google.com: domain of linux-kernel+bounces-18333-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18333-ouuuleilei=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 25BC91C235BA for ; Fri, 5 Jan 2024 20:39:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5944225AF; Fri, 5 Jan 2024 20:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="BPbJQJuU" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 E56BE1EB33; Fri, 5 Jan 2024 20:39:03 +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 (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 405KAGfa004588; Fri, 5 Jan 2024 12:38:57 -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=WanHoCGn2FkkaCWsFdREZ6VNRHR/RlLjYJnYh5Hy9vs=; b=BPb JQJuUQvS3Qb2NBt+aDYY/GB4qNVWqsVN4F3zjuk9RrI/U24QNJynjgy4X/n309xm KQSNfeateGeFwIqUHESF0PnN/HFIxvJvf5rI6ggz/T+0kqln2CYRCXm6tLNHiENt 1oPyoxmcNipS5VZDmmM0ZWsmVaUfvDgQ4hYsajJQhFLMWh5AISj+UfsgokUAj3ea ZfBlyiGtmJ5WwV15zAMpsA5gE5ShlGVbqn8u6mm4a8ChDXsTGJ/RKoT5SXpSRSJE Op5DySAjfjk7ym7WMa4YMN8fITqkQDY2+/Z6FZh5bbQSgNoyMAUJgTxZuUGciQk9 WENAf/k1SpriAL6RQ9g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3veaw02ps4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 05 Jan 2024 12:38:56 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 5 Jan 2024 12:38:54 -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; Fri, 5 Jan 2024 12:38:54 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 536E93F707B; Fri, 5 Jan 2024 12:38:54 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , , Veerasenareddy Burru , Satananda Burla , "David S. Miller" , Eric Dumazet Subject: [PATCH net-next v3 5/8] octeon_ep_vf: add support for ndo ops Date: Fri, 5 Jan 2024 12:38:20 -0800 Message-ID: <20240105203823.2953604-6-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240105203823.2953604-1-srasheed@marvell.com> References: <20240105203823.2953604-1-srasheed@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: g18vX3BIPXL0Q-toEfIMdmSFdJ1Nl0V0 X-Proofpoint-ORIG-GUID: g18vX3BIPXL0Q-toEfIMdmSFdJ1Nl0V0 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787284333894608602 X-GMAIL-MSGID: 1787284333894608602 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 --- V3: - 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 | 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 51f92c8223e8..de79942b5c92 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,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. * @@ -312,6 +365,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,