Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1525431lql; Tue, 12 Mar 2024 23:33:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbEJbGEY/LZxWOTZFwAmKY2bz2zJ2lublvbFpmC4wFieJnCOnManmkWRzAa8PEhTwLML9AY8QJMD8dWZElUI/2ctKtk0odTRTpTwpJtA== X-Google-Smtp-Source: AGHT+IFBMz5mKDzSRfEo1MMPsK8DKixUXdUA+LQsqIHPBCg5DJ8KcykzlSjbK20j4jWi78EN5MSX X-Received: by 2002:a05:6a00:928f:b0:6e5:64cd:8f52 with SMTP id jw15-20020a056a00928f00b006e564cd8f52mr2072342pfb.0.1710311622964; Tue, 12 Mar 2024 23:33:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710311622; cv=pass; d=google.com; s=arc-20160816; b=BAU6cmWqhWzhyMkLoq35KTIpsOYyuaPSc3QX8PyVoc0vxuNZY/oDpCT8xcVq4dtC/I AarmZmq7zl3QFU+zhRJFkI4j8gdUkNwHnL/Gh4CKYyMTcfLa/QIrGwwqKu6eacgzp0I+ IO/mZaxps7ix2BAKTvrvkUdQyHj/l93K6RSyG+aI64p/Ig5SyDToBx3LELtcBwWLzoXy efd6WQjnpDveJRA7yyCNRngx9QPZqGytFjlH9bIZcdyYLF0Zp7EQuO9cGu3VpBldotJX a3tCe4nV6yu0aVdJ2BynmhY+ZhuNKWa5tnFnsx9VZ8yfuDwV1Gz4HlEwH3pp1su1NOsA tPUA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=j9SqWvWQBt7wm9bpLwobyyiq2bV0O/zls6CGCynDx8Y=; fh=wPv/fmS7iNNmCH0mdUKjkT6XsNx1nMbXFeqwvq2D6q0=; b=jWFIcP+AES+TqN9801RuQSxkt0Xj1lC2yROyU62BB0CiYglmYn2pU0xvISC2bZ60ij jNzR3qZVeSlISjyp/nM7z4151lf0NJgO7aF4q4Hm5YtE7E/HGhNXlD/pia38Dn6LOXPi 8EzprRH43qkU3lt1oaX3G67H5AJY7UfC502dOo0U+iJP/zZrObMHczpZh1IlWZxpzxTq o2PvsE2MxQoRjWvdhofYzX5xzq1qFUqxbQe87CQxLCRt5AcEolKrnPjETadmFcTn0yuC v0ygfOcghjWRACbP+dqPUycHHTf4RluN0wsZ9LgW6HTMwvN+qiea3NifkNx5M8q/KmVi oVNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=K55qBZTE; 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-101139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e11-20020a056a0000cb00b006e622ffb2aesi8199603pfj.297.2024.03.12.23.33.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 23:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=K55qBZTE; 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-101139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101139-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 974F428326C for ; Wed, 13 Mar 2024 06:33:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AC4914ABC; Wed, 13 Mar 2024 06:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="K55qBZTE" 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 B420ABA5E; Wed, 13 Mar 2024 06:33:31 +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=1710311613; cv=none; b=iQN874hRelOakZ2oVA01IjdSLBPNqIsx02KjNNNrGu6HcehjJIlHLKRHeusrQHoe1mb4cESLec0HYXr+0Hg0TsVfGMFLMIfMOOqPvK6PvmqooYWuPPvB2n4HPQleD7dWo7Vg8KCRldgGZVhLS6OCGpAhuaV3sNEYlCDC4Ygm4p8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710311613; c=relaxed/simple; bh=9Zs1KGyWNWhmAejwgtyMJIfOriycRX1MdIXZB6Zlp3w=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gl9vpSibE20QeeO1jI8uhIcfhKbqN/hh/iOB9iV7InDIX/IBaVcV376Q9QHiXqxTyKC4q4vBIM8xMdKM+Bbc0ZVObZSFpw5LMlRq86OQgBcoYJDphHDcDn8SoDW+1RQ0tbyFuN0u1Iba8FCsjqoEJ9NH/iUdOHJcxdwlUFhvzzI= 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=K55qBZTE; 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 42D3BMFs015050; Tue, 12 Mar 2024 23:33:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= pfpt0220; bh=j9SqWvWQBt7wm9bpLwobyyiq2bV0O/zls6CGCynDx8Y=; b=K55 qBZTE9x/5sDJTAQVAm3g0N1cdtJRKM6EhZROyGBYBJDHRu/bLBsaXXNyIbONqQAs Xijzg6lyorOllNfL1Pmvibw40DAl0/gebPKpZpOpfiwyaiGNWp6E1wJmRvV2BGtl loV/rq2uCNb3jTGjYcuUjVdyg4XeKDFlur3avGbEq2TCJ4yrJS8wvgDXjOjZ38u5 N7yPYyEvBi6g95DTTOTYkFA9CaWZpXiTyNR+dGFsiYr6yhBThSrRB92IFDJkxnC7 a3SwK2uXrLUkibMIE+yd18Ovc/PcMVsIVc+lG53j48PAbV9xuwmZ/Z8GuZrCQoBU XuTDVl3ZFZpj+UkABsA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3wtt8htq8t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Mar 2024 23:33:11 -0700 (PDT) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Tue, 12 Mar 2024 23:33:10 -0700 Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 12 Mar 2024 23:33:10 -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.1258.12 via Frontend Transport; Tue, 12 Mar 2024 23:33:10 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 3CA103F7082; Tue, 12 Mar 2024 23:33:06 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [v2 net PATCH] octeontx2-pf: Disable HW TSO for seg size < 16B Date: Wed, 13 Mar 2024 12:03:06 +0530 Message-ID: <20240313063306.32571-1-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 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-ORIG-GUID: ysWmEXmgCdF5PXVpake7vdK5iiKJ0SAA X-Proofpoint-GUID: ysWmEXmgCdF5PXVpake7vdK5iiKJ0SAA 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-03-13_06,2024-03-12_01,2023-05-22_02 Current NIX hardware do not support TSO for the segment size less 16 bytes. This patch disable hw TSO for such packets. Fixes: 86d7476078b8 ("octeontx2-pf: TCP segmentation offload support"). Signed-off-by: Geetha sowjanya --- v1-v2: - As suggested by Eric Dumazet used ndo_features_check(). - Moved the max fargments support check to ndo_features_check. .../marvell/octeontx2/nic/otx2_common.c | 18 ++++++++++++++++++ .../marvell/octeontx2/nic/otx2_common.h | 3 +++ .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 1 + .../ethernet/marvell/octeontx2/nic/otx2_txrx.c | 11 ----------- .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 1 + 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c index 02d0b707aea5..de61c69370be 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -221,6 +221,24 @@ int otx2_set_mac_address(struct net_device *netdev, void *p) } EXPORT_SYMBOL(otx2_set_mac_address); +netdev_features_t +otx2_features_check(struct sk_buff *skb, struct net_device *dev, + netdev_features_t features) +{ + /* Due to hw issue segment size less than 16 bytes + * are not supported. Hence do not offload such TSO + * segments. + */ + if (skb_is_gso(skb) && skb_shinfo(skb)->gso_size < 16) + features &= ~NETIF_F_GSO_MASK; + + if (skb_shinfo(skb)->nr_frags + 1 > OTX2_MAX_FRAGS_IN_SQE) + features &= ~NETIF_F_SG; + + return features; +} +EXPORT_SYMBOL(otx2_features_check); + int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu) { struct nix_frs_cfg *req; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h index 06910307085e..6a4bf43bc77e 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h @@ -961,6 +961,9 @@ void otx2_get_mac_from_af(struct net_device *netdev); void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx); int otx2_config_pause_frm(struct otx2_nic *pfvf); void otx2_setup_segmentation(struct otx2_nic *pfvf); +netdev_features_t otx2_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t features); /* RVU block related APIs */ int otx2_attach_npa_nix(struct otx2_nic *pfvf); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index e5fe67e73865..2364eb8d6732 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -2737,6 +2737,7 @@ static const struct net_device_ops otx2_netdev_ops = { .ndo_xdp_xmit = otx2_xdp_xmit, .ndo_setup_tc = otx2_setup_tc, .ndo_set_vf_trust = otx2_ndo_set_vf_trust, + .ndo_features_check = otx2_features_check, }; static int otx2_wq_init(struct otx2_nic *pf) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c index f828d32737af..9b89aff42eb0 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c @@ -1158,17 +1158,6 @@ bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq, num_segs = skb_shinfo(skb)->nr_frags + 1; - /* If SKB doesn't fit in a single SQE, linearize it. - * TODO: Consider adding JUMP descriptor instead. - */ - if (unlikely(num_segs > OTX2_MAX_FRAGS_IN_SQE)) { - if (__skb_linearize(skb)) { - dev_kfree_skb_any(skb); - return true; - } - num_segs = skb_shinfo(skb)->nr_frags + 1; - } - if (skb_shinfo(skb)->gso_size && !is_hw_tso_supported(pfvf, skb)) { /* Insert vlan tag before giving pkt to tso */ if (skb_vlan_tag_present(skb)) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index 35e06048356f..04aab04e4ba2 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -483,6 +483,7 @@ static const struct net_device_ops otx2vf_netdev_ops = { .ndo_tx_timeout = otx2_tx_timeout, .ndo_eth_ioctl = otx2_ioctl, .ndo_setup_tc = otx2_setup_tc, + .ndo_features_check = otx2_features_check, }; static int otx2_wq_init(struct otx2_nic *vf) -- 2.25.1