Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2148248lqt; Mon, 22 Apr 2024 02:54:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXWxwfBT8pMPHHGMhJpVzqpKUAt0pk4i/lYOIpWyVw/PiuNpHoaxA6FPt5cWOptK2zkHgMZC2cOoDyXHgA2+mA21yLdI1G0N38pNJQyIA== X-Google-Smtp-Source: AGHT+IGnKERejXAGLq4jjiZiIMLfgsbLf6dVwIOjv0jakPj2WM7MLIbrlNlmnO0Nxa00oON7ts8a X-Received: by 2002:a17:906:66da:b0:a54:c130:21fd with SMTP id k26-20020a17090666da00b00a54c13021fdmr5323041ejp.13.1713779686520; Mon, 22 Apr 2024 02:54:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713779686; cv=pass; d=google.com; s=arc-20160816; b=KAG3WND8MROOvVZeOyOIub9UJVM6Qa09mysJVYcvxha2B4H7ir+XkauDUjQIh1pYh4 FB4wglMRv1ZYnS6uyAABXPQrAeUn+GAswVOFSj5x3A8q3pO/U/Ix7pzPDeizx6GtdIvg cbpFvVaMbJW53uh3bziXlBAiTnX7wdVzBKq4oIwbeMEnTN1sAHotU1Ez5G8PPJehczxH Sexxnk/wLbXAy0iQksmH14IYnH+M7bKCj8gTkjUoGFB6E3a5UcthUre2G/pZjW0T7phD sbDFhQh2LUi8N4evhWy/Sf1gl+UhX9JNfJWKWbNCif15mQnX5NNElcQiYZ2wkRWzFZYc x4FQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HkSztpL8d8RuIyxGKn7+AfCtuqkF2pAuPjmtfCXWHdI=; fh=wPv/fmS7iNNmCH0mdUKjkT6XsNx1nMbXFeqwvq2D6q0=; b=kfCZ8IRG+EU8ACYLQvHKLtWj6skEn1NHK7+Oqj5mr28mOB+Kvebcq/nciOhYagIVRI yV33q+T/EHuqyB81sj6fjIQ20gowAeEhTNGsjTCaCeVzKpAQE5L9tSmmwXeTLMD8pAMa g3JfBjR9EjWVpNyiRyQS+yVzeshRhrnFO2d9gBVpB2IATCPmrESw6uNnPa1hNVq+ejXg AteBcngwqDVr6wCIby2uvMgDtcKNYvB2QtdxOJGr+yH1zvBltM7l0tVi5mfPk+tUDb7V k/9xEjIiImVz4T6EnHh3MNrkyMD4Zk3Z052BGXt9KwzQmkuKJTTo7fBu6+xYkBznrqXc biEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=FMo63fbV; 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-153131-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153131-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e15-20020a170906504f00b00a51b7e1f165si5730447ejk.727.2024.04.22.02.54.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 02:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153131-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=FMo63fbV; 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-153131-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153131-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1D3391F2171D for ; Mon, 22 Apr 2024 09:54:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D54A313DDDD; Mon, 22 Apr 2024 09:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="FMo63fbV" 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 BB5E213C815; Mon, 22 Apr 2024 09:54:26 +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=1713779668; cv=none; b=eE9R2KIosxKbyWkBQU1Ku2jr6AC9U+2nn2/aumGqu3wvEHgPTAptFtz4DooXf0+fPgtcg/loUORdhPj1Uh8WSodQw4yJboZplTm6+aWS2BEyrk4CQUCdvqxUzFtYh4506rQTQCAFc3X+JYuHqvsR0HZJfflXKqGKoOY2bSfwPgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713779668; c=relaxed/simple; bh=BHBrDHi8GQvSP/VeVfTgrmRbfRHj01y5R2ebO5M6zLA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y5Ir6WMs6xb3liX+TDfCupEYMKYePIOvRJIA0ZLlKfv0yacC5rPlXN609rllsTZnPAEQnRMOR12m83nXiWofyXM5B5joFU/sQy91FwjJMFIVLC61x/RmyO/pxDBHp2QXT5q67QPjj1WY48aXk7V8oQW1eNsPIdu/wgM4IvZdvjY= 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=FMo63fbV; 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.18.1.2/8.18.1.2) with ESMTP id 43M9hAU4013946; Mon, 22 Apr 2024 02:54:21 -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=HkSztpL8d8RuIyxGKn7+A fCtuqkF2pAuPjmtfCXWHdI=; b=FMo63fbVxDkNq5jIkSkl6YDB5+7ZaAhZJsgs3 oKLCreziYpbVa+sjWHDDR3IeKKL21bX43Q80pafMSx8hJhszVmkh9pOHOuYJVUNB GsUQnm6/lf62cZoexgvJI/HtHdKgctvU6E8aLITTuGLf3t7DLVk1JSdRlm5U2633 QtuJN4zM4+p8qIAvhsJohksMpyPyi5zz3mNUukBQne+8LIUR5PDERzzLZu0mhOzg GKX2NahnIEHs91mGI6YUEerimUAgchai7Xjv7vSybf9VrjLlazKxzey6DCDC9tbN kpfVzRZAfhz6PEgBUdA9Ix8EFfX3N0CnwxDkBllEELReJShcg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3xnngcr17f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 Apr 2024 02:54:21 -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; Mon, 22 Apr 2024 02:54:20 -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; Mon, 22 Apr 2024 02:54:20 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 41AFF3F705C; Mon, 22 Apr 2024 02:54:17 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [net-next PATCH v2 4/9] octeontx2-pf: Add basic net_device_ops Date: Mon, 22 Apr 2024 15:23:56 +0530 Message-ID: <20240422095401.14245-5-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240422095401.14245-1-gakula@marvell.com> References: <20240422095401.14245-1-gakula@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: zEiHjoqxlpD0A4dfRCcqEhD2s46J8bfN X-Proofpoint-ORIG-GUID: zEiHjoqxlpD0A4dfRCcqEhD2s46J8bfN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_07,2024-04-19_01,2023-05-22_02 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 e2571728cb0d..4515f1aebea1 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; @@ -149,6 +194,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; -- 2.25.1