From patchwork Tue Apr 16 05:06: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: 13631257 X-Patchwork-Delegate: kuba@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 4A4913CF4F; Tue, 16 Apr 2024 05:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713244004; cv=none; b=WMFn2R1h8iTEfYaIh18U9rcIYMwQ9RnsJPsWNOdGyA8UUOUh9aY0FnGQslkhG6J/JwALRaR7HXyw675YvpHQEizYLdbcx6LPAbbHtRkyvRNcZIkLfxdI8ynouF3kIc1ySSylVyjDAeu3G3y4EgEaUnik9nCmYmq+5nkqEV7jUq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713244004; c=relaxed/simple; bh=sp115HqaeZT+rGce+Dc0Iml/enneYEsP5CHlQwgtsGA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m9tdVzl5rDuhhsjUwo9bV3aVhXq+/v0E41YZ77voN4NOfE7z71cDyeR/+SRfjFWHbO1XAKe+MEC5i9ou94neoCervdKQTnndPiA+qm1jwraaVt4vNrhQVBCI3L/rFNHr7yweWONvCfb8Lrf5qMZXfSeyoK4p1PkQfYaOz32iC28= 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=N7ujOg8a; arc=none smtp.client-ip=67.231.156.173 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="N7ujOg8a" 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 43G19Wxv030024; Mon, 15 Apr 2024 22:06:37 -0700 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-type; s=pfpt0220; bh=IomZQneRZUUTemp1/7I6l tzR08bUZXpi9sQ91xdaAn0=; b=N7ujOg8a/4yqDQbk4WIqVA02EMr+bHpSMj+AB nUYFy7d3/RHRYzL9N3lzeWf88FhAMGZKttJZ4HYdcpdtfpgaQl86hKqpDcEZUNzj kcSO0bwTKt/cp+HO2ZQXQSYJA/Z9pFdqJ6qmavrfX5ut2ECtJs+3lc3rERGtEtr8 MKpodB9xkgzr5LizB/zO0atoB+V/fg74DcPbktUfWwM/+jntIqvVma83K7nDZYjE Drvf9P3d1Wmk28jukwOH9p2Q2V+spSCN34AHYOl6JiiiY9uoy5CU11kkFArJrM5l nZkeBkH9c+BwCxkgGOFJ1S3vKvw15l1rZct0or8KJh8xqWJOw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3xhfdn0j7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Apr 2024 22:06:36 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 15 Apr 2024 22:06:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 15 Apr 2024 22:06:35 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 422913F7083; Mon, 15 Apr 2024 22:06:32 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [net-next PATCH 4/9] octeontx2-pf: Add basic net_device_ops Date: Tue, 16 Apr 2024 10:36:11 +0530 Message-ID: <20240416050616.6056-5-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240416050616.6056-1-gakula@marvell.com> References: <20240416050616.6056-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: PZCsfoDp168RG3zE0_KlSmQu6vwXphLS X-Proofpoint-ORIG-GUID: PZCsfoDp168RG3zE0_KlSmQu6vwXphLS 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-04-16_02,2024-04-15_01,2023-05-22_02 X-Patchwork-Delegate: kuba@kernel.org Implements basic set of net_device_ops. Signed-off-by: Geetha sowjanya --- .../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 fd55ef40c934..187b00156bcd 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, incase 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 otx2_cq_poll *cq_poll = NULL; @@ -157,6 +202,7 @@ int rvu_rep_create(struct otx2_nic *priv) 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;