From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 45B35A0096 for ; Mon, 8 Apr 2019 13:24:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77C135F1A; Mon, 8 Apr 2019 13:23:11 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00054.outbound.protection.outlook.com [40.107.0.54]) by dpdk.org (Postfix) with ESMTP id 06AB454AE for ; Mon, 8 Apr 2019 13:22:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OZrqYRG0oa9zaAn2WmciuEwv2+OwqARVAJrOEWC7gO0=; b=xeA/JVBg+d2k7zjNW4XER/xK0OFxgFCN5f1jcWRD4lBHa+CFCxjH1PIqG5/DY/SG9wRMz+lGH/yLFHlnZw46Cbp9H3rN12wtY/DYKDq2xDk0c5DT1ISmH+oVeAyIJh86kvr7Wwtc2pMEZY9XcWrafMnWmh95hYlcmVCPNElh/QE= Received: from VE1PR04MB6365.eurprd04.prod.outlook.com (10.255.118.78) by VE1PR04MB6606.eurprd04.prod.outlook.com (20.179.235.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.13; Mon, 8 Apr 2019 11:22:46 +0000 Received: from VE1PR04MB6365.eurprd04.prod.outlook.com ([fe80::f5ad:f178:4c55:13e0]) by VE1PR04MB6365.eurprd04.prod.outlook.com ([fe80::f5ad:f178:4c55:13e0%3]) with mapi id 15.20.1771.016; Mon, 8 Apr 2019 11:22:46 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , "ferruh.yigit@intel.com" CC: Gagandeep Singh Thread-Topic: [PATCH 11/13] net/enetc: enable CRC offload feature Thread-Index: AQHU7f1jH7Tuv9Q5oEmnJWxGx3noZw== Date: Mon, 8 Apr 2019 11:22:46 +0000 Message-ID: <1554745507-15089-12-git-send-email-g.singh@nxp.com> References: <1554745507-15089-1-git-send-email-g.singh@nxp.com> In-Reply-To: <1554745507-15089-1-git-send-email-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0003.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::13) To VE1PR04MB6365.eurprd04.prod.outlook.com (2603:10a6:803:12a::14) x-mailer: git-send-email 1.9.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.120.1.67] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ac35d7ca-cf0e-4966-c6e3-08d6bc1485f4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VE1PR04MB6606; x-ms-traffictypediagnostic: VE1PR04MB6606: x-microsoft-antispam-prvs: x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(39860400002)(396003)(136003)(199004)(189003)(76176011)(97736004)(81156014)(71200400001)(71190400001)(72206003)(3846002)(25786009)(81166006)(53936002)(2616005)(5660300002)(6116002)(8676002)(7736002)(446003)(478600001)(8936002)(11346002)(305945005)(2906002)(256004)(14444005)(66066001)(6512007)(476003)(6436002)(486006)(50226002)(2501003)(99286004)(106356001)(86362001)(110136005)(4326008)(6486002)(68736007)(105586002)(6506007)(52116002)(316002)(26005)(386003)(14454004)(186003)(36756003)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR04MB6606; H:VE1PR04MB6365.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2G7ssfgqMlDlLNtP58eJM5AawROiT58rLUPw34sPQgVwcpuO+cNMJX0MtxQl5UwmxzFFmqqjDJDrz3GTlKMlIEFouXqZ+muyT06Q7aDCk7hx/Qt5PopCBd0AG1W+6nA2bSS/XChpZqpdHR4haJjdYop1Zy9tg8l/uPuS+yueniDcRjej7LFqlpWQbgFRIXOTH8QYMIBoJDcmJWQIxfXTxGubMyKcy+v6B4uwCHcT4Ve5ZPWJ68cNX87wgGGASZUTlqygjCyGIwUxhPuHQj3TAfCs7OqgkUvHrHSt99VVxNuqn7krzjttcwVS54ZgYm2E7XEmc++/n/WpMJ0Env79QnAgW6q7Ie4EilCp94Xp0vYdp89lL/8SYuy3dJHpFQIqA0cXl831rjhd/2yf8GICpUhM9KiFrQi9l1VLNgaWqHQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac35d7ca-cf0e-4966-c6e3-08d6bc1485f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2019 11:22:46.0669 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6606 Subject: [dpdk-dev] [PATCH 11/13] net/enetc: enable CRC offload feature X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190408112246.qLAu8t4SqcBP3QA-EP3sIiGO8LnRpkO3Tqu4rvP3F2Y@z> CRC offload keep feature supported Signed-off-by: Gagandeep Singh --- doc/guides/nics/enetc.rst | 1 + doc/guides/nics/features/enetc.ini | 1 + drivers/net/enetc/base/enetc_hw.h | 1 + drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc_ethdev.c | 20 +++++++++++++++++--- drivers/net/enetc/enetc_rxtx.c | 6 ++++-- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/enetc.rst b/doc/guides/nics/enetc.rst index 26d61f6..2620460 100644 --- a/doc/guides/nics/enetc.rst +++ b/doc/guides/nics/enetc.rst @@ -52,6 +52,7 @@ ENETC Features - Jumbo packets - Queue Start/Stop - Deferred Queue Start +- CRC offload =20 NIC Driver (PMD) ~~~~~~~~~~~~~~~~ diff --git a/doc/guides/nics/features/enetc.ini b/doc/guides/nics/features/= enetc.ini index bd901fa..101dc0a 100644 --- a/doc/guides/nics/features/enetc.ini +++ b/doc/guides/nics/features/enetc.ini @@ -12,6 +12,7 @@ Allmulticast mode =3D Y MTU update =3D Y Jumbo frame =3D Y Queue start/stop =3D Y +CRC offload =3D Y Linux VFIO =3D Y ARMv8 =3D Y Usage doc =3D Y diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/ene= tc_hw.h index 2eb1df3..261ad15 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -97,6 +97,7 @@ #define ENETC_PM0_CMD_CFG 0x08008 #define ENETC_PM0_TX_EN BIT(0) #define ENETC_PM0_RX_EN BIT(1) +#define ENETC_PM0_CRC BIT(6) =20 #define ENETC_PM0_MAXFRM 0x08014 #define ENETC_SET_TX_MTU(val) ((val) << 16) diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h index e494eb8..8c830a5 100644 --- a/drivers/net/enetc/enetc.h +++ b/drivers/net/enetc/enetc.h @@ -69,6 +69,7 @@ struct enetc_bdr { void *tcisr; /* Tx */ int next_to_alloc; /* Rx */ }; + uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */ }; =20 /* diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_eth= dev.c index db23276..a59a030 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -162,7 +162,9 @@ dev_info->max_rx_queues =3D MAX_RX_RINGS; dev_info->max_tx_queues =3D MAX_TX_RINGS; dev_info->max_rx_pktlen =3D ENETC_MAC_MAXFRM_SIZE; - dev_info->rx_offload_capa =3D DEV_RX_OFFLOAD_JUMBO_FRAME; + dev_info->rx_offload_capa =3D + (DEV_RX_OFFLOAD_KEEP_CRC | + DEV_RX_OFFLOAD_JUMBO_FRAME); } =20 static int @@ -378,6 +380,7 @@ struct rte_eth_dev_data *data =3D dev->data; struct enetc_eth_adapter *adapter =3D ENETC_DEV_PRIVATE(data->dev_private); + uint64_t rx_offloads =3D data->dev_conf.rxmode.offloads; =20 PMD_INIT_FUNC_TRACE(); if (nb_rx_desc > MAX_BD_COUNT) @@ -410,6 +413,9 @@ RTE_ETH_QUEUE_STATE_STOPPED; } =20 + rx_ring->crc_len =3D (uint8_t)((rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) ? + ETHER_CRC_LEN : 0); + return 0; fail: rte_free(rx_ring); @@ -630,11 +636,11 @@ int enetc_stats_get(struct rte_eth_dev *dev, static int enetc_dev_configure(struct rte_eth_dev *dev) { - struct rte_eth_conf *eth_conf =3D &dev->data->dev_conf; - uint64_t rx_offloads =3D eth_conf->rxmode.offloads; struct enetc_eth_hw *hw =3D ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct enetc_hw *enetc_hw =3D &hw->hw; + struct rte_eth_conf *eth_conf =3D &dev->data->dev_conf; + uint64_t rx_offloads =3D eth_conf->rxmode.offloads; =20 PMD_INIT_FUNC_TRACE(); =20 @@ -652,6 +658,14 @@ int enetc_stats_get(struct rte_eth_dev *dev, dev->data->mtu =3D ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN; } =20 + if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) { + int config; + + config =3D enetc_port_rd(enetc_hw, ENETC_PM0_CMD_CFG); + config |=3D ENETC_PM0_CRC; + enetc_port_wr(enetc_hw, ENETC_PM0_CMD_CFG, config); + } + return 0; } =20 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.= c index 90d6979..7497a47 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -207,8 +207,10 @@ static inline void __attribute__((hot)) if (!bd_status) break; =20 - rx_swbd->buffer_addr->pkt_len =3D rxbd->r.buf_len; - rx_swbd->buffer_addr->data_len =3D rxbd->r.buf_len; + rx_swbd->buffer_addr->pkt_len =3D rxbd->r.buf_len - + rx_ring->crc_len; + rx_swbd->buffer_addr->data_len =3D rxbd->r.buf_len - + rx_ring->crc_len; rx_swbd->buffer_addr->hash.rss =3D rxbd->r.rss_hash; rx_swbd->buffer_addr->ol_flags =3D 0; enetc_dev_rx_parse(rx_swbd->buffer_addr, --=20 1.9.1