From patchwork Fri Jul 5 10:16:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geetha sowjanya X-Patchwork-Id: 13724905 X-Patchwork-Delegate: kuba@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 EA45E148FF7; Fri, 5 Jul 2024 10:17:20 +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=1720174642; cv=none; b=tNGMfF92fZCUXgf/0Rfx57EpU7k7t3CpySnDBQT7mFpif2Xf5Hv7VKUVtHVx29lyVvJCp/vB3K5I81cnwXqPgu2o4N4pJd6Da+cjLEHf2qMcr2aJnihJPqp5l6kn4GMz0nlIuYWpaSx2cWSc2MXfVgBlJ3JxyqFa+5MZ2mq87OQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720174642; c=relaxed/simple; bh=teilrp+twnas5Xjp6g4BakB56Ij3NoZ3yaTI9qsdUmc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HOIdcDAKDLZeFYkwXP5WiPANo5km9oB2/2D0V5FFVSOoZjrEHNs4JAfXYm+/wyQKqGXLNBg6S8ufDpdNbWu+s1jPR7M7Tauous+vIgG/GZMym5vPzIq3tOJt4UZBEaSB4DY9iqUEDsQbIuYaQKZP0oZhpq3oA5a+9Hbi+ROvFlg= 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=HARZI41z; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="HARZI41z" Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4659PKe6029609; Fri, 5 Jul 2024 03:17:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pfpt0220; bh=wc7ZA68weQMg57+X9daBzarfL BLGdJER25P9521/Zs8=; b=HARZI41zo+2dlgvR9O0Q3pRvghMpoOIIGsf7CNY6r zDjTr3aYTflZGdNIj8LBjhWhH01dHC+hn6u3u/uC+vA6FDwvwxFDvqpbLL1X7tX6 3n2jsTK8jG0cYEDVc13TxITZZDSZxsLdlLYXeFQhnZDlN1PlRHMxJABA7kSwSJJ7 nXmv7dVqnTra97thd74R1xcjKekKEZWmDkIEqUgtu7zCq3PZvEv3i5EHJYh9njr3 EEGF6O0vyuCytcR5jJeS/H3NQfnlUMmaRfbUF2iKpLHdneQwVAwRrW0w64jmvV8v CNYLgfx6NO53puFUTvMDLffR/C3L8jccWtxhrHiazonfQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 406e6c04v9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jul 2024 03:17:15 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 5 Jul 2024 03:16:36 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 5 Jul 2024 03:16:36 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id B318C3F7040; Fri, 5 Jul 2024 03:16:33 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [net-next PATCH v8 04/11] octeontx2-pf: Add basic net_device_ops Date: Fri, 5 Jul 2024 15:46:11 +0530 Message-ID: <20240705101618.18415-5-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240705101618.18415-1-gakula@marvell.com> References: <20240705101618.18415-1-gakula@marvell.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: Sd9zFKkJ3IyWdi6I14NyOSUMuLRHQBcS X-Proofpoint-ORIG-GUID: Sd9zFKkJ3IyWdi6I14NyOSUMuLRHQBcS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_06,2024-07-03_01,2024-05-17_01 X-Patchwork-Delegate: kuba@kernel.org Implements basic set of net_device_ops. Signed-off-by: Geetha sowjanya Reviewed-by: Simon Horman --- .../net/ethernet/marvell/octeontx2/nic/rep.c | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c index 6ea5b4904a7c..a021350fe83a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c @@ -28,6 +28,51 @@ MODULE_DESCRIPTION(DRV_STRING); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, rvu_rep_id_table); +static netdev_tx_t rvu_rep_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct rep_dev *rep = netdev_priv(dev); + struct otx2_nic *pf = rep->mdev; + struct otx2_snd_queue *sq; + struct netdev_queue *txq; + + sq = &pf->qset.sq[rep->rep_id]; + txq = netdev_get_tx_queue(dev, 0); + + if (!otx2_sq_append_skb(pf, txq, sq, skb, rep->rep_id)) { + netif_tx_stop_queue(txq); + + /* Check again, in case SQBs got freed up */ + smp_mb(); + if (((sq->num_sqbs - *sq->aura_fc_addr) * sq->sqe_per_sqb) + > sq->sqe_thresh) + netif_tx_wake_queue(txq); + + return NETDEV_TX_BUSY; + } + return NETDEV_TX_OK; +} + +static int rvu_rep_open(struct net_device *dev) +{ + netif_carrier_on(dev); + netif_tx_start_all_queues(dev); + return 0; +} + +static int rvu_rep_stop(struct net_device *dev) +{ + netif_carrier_off(dev); + netif_tx_disable(dev); + + return 0; +} + +static const struct net_device_ops rvu_rep_netdev_ops = { + .ndo_open = rvu_rep_open, + .ndo_stop = rvu_rep_stop, + .ndo_start_xmit = rvu_rep_xmit, +}; + static int rvu_rep_napi_init(struct otx2_nic *priv, struct netlink_ext_ack *extack) { @@ -156,6 +201,7 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack) ndev->min_mtu = OTX2_MIN_MTU; ndev->max_mtu = priv->hw.max_mtu; + ndev->netdev_ops = &rvu_rep_netdev_ops; pcifunc = priv->rep_pf_map[rep_id]; rep->pcifunc = pcifunc;