get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/41270/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 41270,
    "url": "https://patches.dpdk.org/api/patches/41270/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180619180230.72585-1-ferruh.yigit@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180619180230.72585-1-ferruh.yigit@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180619180230.72585-1-ferruh.yigit@intel.com",
    "date": "2018-06-19T18:02:30",
    "name": "ethdev: add new offload flag to keep CRC",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9cf6a5f022c06d0783670fc38d4845456f84156b",
    "submitter": {
        "id": 324,
        "url": "https://patches.dpdk.org/api/people/324/?format=api",
        "name": "Ferruh Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180619180230.72585-1-ferruh.yigit@intel.com/mbox/",
    "series": [
        {
            "id": 170,
            "url": "https://patches.dpdk.org/api/series/170/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=170",
            "date": "2018-06-19T18:02:30",
            "name": "ethdev: add new offload flag to keep CRC",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/170/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/41270/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/41270/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 25EFF4CA5;\n\tTue, 19 Jun 2018 19:03:02 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 738F14C9D\n\tfor <dev@dpdk.org>; Tue, 19 Jun 2018 19:03:00 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Jun 2018 10:02:58 -0700",
            "from silpixa00399752.ir.intel.com (HELO\n\tsilpixa00399752.ger.corp.intel.com) ([10.237.222.212])\n\tby fmsmga005.fm.intel.com with ESMTP; 19 Jun 2018 10:02:51 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,243,1526367600\"; d=\"scan'208\";a=\"238503371\"",
        "From": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "To": "Neil Horman <nhorman@tuxdriver.com>,\n\tJohn McNamara <john.mcnamara@intel.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>,\n\t\"John W. Linville\" <linville@tuxdriver.com>,\n\tAllain Legacy <allain.legacy@windriver.com>,\n\tMatt Peters <matt.peters@windriver.com>,\n\tRavi Kumar <ravi1.kumar@amd.com>, \n\tAjit Khaparde <ajit.khaparde@broadcom.com>,\n\tSomnath Kotur <somnath.kotur@broadcom.com>,\n\tRahul Lakkireddy <rahul.lakkireddy@chelsio.com>,\n\tWenzhuo Lu <wenzhuo.lu@intel.com>, Qi Zhang <qi.z.zhang@intel.com>,\n\tXiao Wang <xiao.w.wang@intel.com>, Beilei Xing <beilei.xing@intel.com>,\n\tKonstantin Ananyev <konstantin.ananyev@intel.com>,\n\tAdrien Mazarguil <adrien.mazarguil@6wind.com>,\n\tNelio Laranjeiro <nelio.laranjeiro@6wind.com>,\n\tYongseok Koh <yskoh@mellanox.com>, Tomasz Duszynski <tdu@semihalf.com>,\n\tDmitri Epshtein <dima@marvell.com>,\n\tNatalie Samsonov <nsamsono@marvell.com>,\n\tJianbo Liu <jianbo.liu@arm.com>, \n\tAlejandro Lucero <alejandro.lucero@netronome.com>,\n\tTetsuya Mukawa <mtetsuyah@gmail.com>,\n\tSantosh Shukla <santosh.shukla@caviumnetworks.com>,\n\tJerin Jacob <jerin.jacob@caviumnetworks.com>,\n\tRasesh Mody <rasesh.mody@cavium.com>,\n\tHarish Patil <harish.patil@cavium.com>,\n\tShahed Shaikh <shahed.shaikh@cavium.com>,\n\tBruce Richardson <bruce.richardson@intel.com>,\n\tAndrew Rybchenko <arybchenko@solarflare.com>,\n\tJasvinder Singh <jasvinder.singh@intel.com>,\n\tCristian Dumitrescu <cristian.dumitrescu@intel.com>,\n\tMatej Vido <vido@cesnet.cz>,\n\tMaciej Czekaj <maciej.czekaj@caviumnetworks.com>,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>,\n\tTiwei Bie <tiwei.bie@intel.com>, Zhihong Wang <zhihong.wang@intel.com>,\n\tYong Wang <yongwang@vmware.com>, Thomas Monjalon <thomas@monjalon.net>",
        "Cc": "dev@dpdk.org,\n\tFerruh Yigit <ferruh.yigit@intel.com>",
        "Date": "Tue, 19 Jun 2018 19:02:30 +0100",
        "Message-Id": "<20180619180230.72585-1-ferruh.yigit@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180608225709.19473-1-ferruh.yigit@intel.com>",
        "References": "<20180608225709.19473-1-ferruh.yigit@intel.com>",
        "Subject": "[dpdk-dev] [PATCH] ethdev: add new offload flag to keep CRC",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "DEV_RX_OFFLOAD_KEEP_CRC offload flag added. PMDs that supports keeping\nCRC should advertise this offload capability.\n\nDEV_RX_OFFLOAD_CRC_STRIP flag will remain one more release\ndefault behavior in PMDs are to keep the CRC until this flag removed\n\nUntil DEV_RX_OFFLOAD_CRC_STRIP flag is removed:\n- Setting both KEEP_CRC & CRC_STRIP is INVALID\n- Setting only CRC_STRIP PMD should strip the CRC\n- Setting only KEEP_CRC PMD should keep the CRC\n- Not setting both PMD should keep the CRC\n\nA helper function rte_eth_dev_is_keep_crc() has been added to be able to\nchange the no flag behavior with minimal changes in PMDs.\n\nThe PMDs that doesn't report the DEV_RX_OFFLOAD_KEEP_CRC offload can\nremove rte_eth_dev_is_keep_crc() checks next release, related code\ncommented to help the maintenance task.\n\nAnd DEV_RX_OFFLOAD_CRC_STRIP has been added to virtual drivers since\nthey don't use CRC at all, when an application requires this offload\nvirtual PMDs should not return error.\n\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\n doc/guides/rel_notes/deprecation.rst      | 10 ---------\n drivers/net/af_packet/rte_eth_af_packet.c |  1 +\n drivers/net/avp/avp_ethdev.c              |  1 +\n drivers/net/axgbe/axgbe_ethdev.c          |  4 +++-\n drivers/net/axgbe/axgbe_rxtx.c            |  6 +++--\n drivers/net/bnxt/bnxt_ethdev.c            |  1 +\n drivers/net/bnxt/bnxt_rxq.c               |  3 +--\n drivers/net/cxgbe/cxgbe_ethdev.c          |  6 ++++-\n drivers/net/e1000/em_rxtx.c               | 20 ++++++++++-------\n drivers/net/e1000/igb_ethdev.c            |  4 ++--\n drivers/net/e1000/igb_rxtx.c              | 27 ++++++++++++++---------\n drivers/net/fm10k/fm10k_ethdev.c          |  6 +++--\n drivers/net/i40e/i40e_ethdev.c            |  1 +\n drivers/net/i40e/i40e_ethdev_vf.c         |  3 ++-\n drivers/net/i40e/i40e_rxtx.c              |  6 +++--\n drivers/net/ixgbe/ixgbe_ethdev.c          |  4 ++--\n drivers/net/ixgbe/ixgbe_ipsec.c           |  2 +-\n drivers/net/ixgbe/ixgbe_rxtx.c            | 25 ++++++++++++---------\n drivers/net/kni/rte_eth_kni.c             |  1 +\n drivers/net/mlx4/mlx4_rxq.c               | 23 ++++++++++---------\n drivers/net/mlx5/mlx5_rxq.c               | 25 ++++++++++++---------\n drivers/net/mvpp2/mrvl_ethdev.c           |  8 ++++---\n drivers/net/nfp/nfp_net.c                 |  9 +++++---\n drivers/net/null/rte_eth_null.c           |  1 +\n drivers/net/octeontx/octeontx_ethdev.c    |  5 ++++-\n drivers/net/pcap/rte_eth_pcap.c           |  1 +\n drivers/net/qede/qede_ethdev.c            |  2 ++\n drivers/net/ring/rte_eth_ring.c           |  1 +\n drivers/net/sfc/sfc_rx.c                  |  5 ++++-\n drivers/net/softnic/rte_eth_softnic.c     |  1 +\n drivers/net/szedata2/rte_eth_szedata2.c   |  3 ++-\n drivers/net/thunderx/nicvf_ethdev.c       |  5 ++++-\n drivers/net/vhost/rte_eth_vhost.c         |  3 ++-\n drivers/net/virtio/virtio_ethdev.c        |  3 ++-\n drivers/net/vmxnet3/vmxnet3_ethdev.c      |  3 ++-\n lib/librte_ethdev/rte_ethdev.c            |  9 ++++++++\n lib/librte_ethdev/rte_ethdev.h            |  5 +++++\n lib/librte_ethdev/rte_ethdev_driver.h     | 20 +++++++++++++++++\n 38 files changed, 172 insertions(+), 91 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst\nindex 1ce692eac..cd128ae23 100644\n--- a/doc/guides/rel_notes/deprecation.rst\n+++ b/doc/guides/rel_notes/deprecation.rst\n@@ -67,16 +67,6 @@ Deprecation Notices\n   - removal of ``txq_flags`` field from ``rte_eth_txconf`` struct.\n   - removal of the offloads bit-field from ``rte_eth_rxmode`` struct.\n \n-* ethdev: A new offloading flag ``DEV_RX_OFFLOAD_KEEP_CRC`` will be added in v18.08,\n-  This will replace the usage of not setting ``DEV_RX_OFFLOAD_CRC_STRIP`` flag\n-  and will be implemented in PMDs accordingly.\n-  In v18.08 both ``DEV_RX_OFFLOAD_KEEP_CRC`` and ``DEV_RX_OFFLOAD_CRC_STRIP`` flags\n-  will be available, usage will be:\n-  ``CRC_STRIP``: Strip CRC from packet\n-  ``KEEP_CRC``: Keep CRC in packet\n-  Both ``CRC_STRIP`` & ``KEEP_CRC``: Invalid\n-  No flag: Keep CRC in packet\n-\n * ethdev: In v18.11 ``DEV_RX_OFFLOAD_CRC_STRIP`` offload flag will be removed, default\n   behavior without any flag will be changed to CRC strip.\n   To keep CRC ``DEV_RX_OFFLOAD_KEEP_CRC`` flag is required.\ndiff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c\nindex ea47abbf8..8cfb7ada4 100644\n--- a/drivers/net/af_packet/rte_eth_af_packet.c\n+++ b/drivers/net/af_packet/rte_eth_af_packet.c\n@@ -305,6 +305,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \tdev_info->max_rx_queues = (uint16_t)internals->nb_queues;\n \tdev_info->max_tx_queues = (uint16_t)internals->nb_queues;\n \tdev_info->min_rx_bufsize = 0;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c\nindex dc97e60e6..9cc8fbcdf 100644\n--- a/drivers/net/avp/avp_ethdev.c\n+++ b/drivers/net/avp/avp_ethdev.c\n@@ -2170,6 +2170,7 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev,\n \t\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;\n \t\tdev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT;\n \t}\n+\tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c\nindex 7a3ba2e7b..e3773f4a2 100644\n--- a/drivers/net/axgbe/axgbe_ethdev.c\n+++ b/drivers/net/axgbe/axgbe_ethdev.c\n@@ -363,7 +363,9 @@ axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \tdev_info->rx_offload_capa =\n \t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\n \t\tDEV_RX_OFFLOAD_UDP_CKSUM  |\n-\t\tDEV_RX_OFFLOAD_TCP_CKSUM;\n+\t\tDEV_RX_OFFLOAD_TCP_CKSUM  |\n+\t\tDEV_RX_OFFLOAD_CRC_STRIP  |\n+\t\tDEV_RX_OFFLOAD_KEEP_CRC;\n \n \tdev_info->tx_offload_capa =\n \t\tDEV_TX_OFFLOAD_IPV4_CKSUM  |\ndiff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c\nindex b302bdd1f..e665ef939 100644\n--- a/drivers/net/axgbe/axgbe_rxtx.c\n+++ b/drivers/net/axgbe/axgbe_rxtx.c\n@@ -74,8 +74,10 @@ int axgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,\n \t\t(DMA_CH_INC * rxq->queue_id));\n \trxq->dma_tail_reg = (volatile uint32_t *)((uint8_t *)rxq->dma_regs +\n \t\t\t\t\t\t  DMA_CH_RDTR_LO);\n-\trxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads &\n-\t\t\tDEV_RX_OFFLOAD_CRC_STRIP) ? 0 : ETHER_CRC_LEN);\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\trxq->crc_len = ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n \n \t/* CRC strip in AXGBE supports per port not per queue */\n \tpdata->crc_strip_enable = (rxq->crc_len == 0) ? 1 : 0;\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex 6e56bfd36..f26461c42 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -147,6 +147,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {\n \t\t\t\t     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \\\n \t\t\t\t     DEV_RX_OFFLOAD_JUMBO_FRAME | \\\n \t\t\t\t     DEV_RX_OFFLOAD_CRC_STRIP | \\\n+\t\t\t\t     DEV_RX_OFFLOAD_KEEP_CRC | \\\n \t\t\t\t     DEV_RX_OFFLOAD_TCP_LRO)\n \n static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);\ndiff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c\nindex c55ddec4b..265901e63 100644\n--- a/drivers/net/bnxt/bnxt_rxq.c\n+++ b/drivers/net/bnxt/bnxt_rxq.c\n@@ -326,8 +326,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,\n \n \trxq->queue_id = queue_idx;\n \trxq->port_id = eth_dev->data->port_id;\n-\trxq->crc_len = rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP ?\n-\t\t0 : ETHER_CRC_LEN;\n+\trxq->crc_len = rte_eth_dev_is_keep_crc(rx_offloads) ? ETHER_CRC_LEN : 0;\n \n \teth_dev->data->rx_queues[queue_idx] = rxq;\n \t/* Allocate RX ring hardware descriptors */\ndiff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c\nindex 713dc8fae..b0156ec77 100644\n--- a/drivers/net/cxgbe/cxgbe_ethdev.c\n+++ b/drivers/net/cxgbe/cxgbe_ethdev.c\n@@ -354,7 +354,11 @@ int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)\n \n \tCXGBE_FUNC_TRACE();\n \tconfigured_offloads = eth_dev->data->dev_conf.rxmode.offloads;\n-\tif (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(configured_offloads)) {\n \t\tdev_info(adapter, \"can't disable hw crc strip\\n\");\n \t\teth_dev->data->dev_conf.rxmode.offloads |=\n \t\t\tDEV_RX_OFFLOAD_CRC_STRIP;\ndiff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c\nindex a6b3e92a6..944118baf 100644\n--- a/drivers/net/e1000/em_rxtx.c\n+++ b/drivers/net/e1000/em_rxtx.c\n@@ -1364,6 +1364,7 @@ em_get_rx_port_offloads_capa(struct rte_eth_dev *dev)\n \t\tDEV_RX_OFFLOAD_UDP_CKSUM   |\n \t\tDEV_RX_OFFLOAD_TCP_CKSUM   |\n \t\tDEV_RX_OFFLOAD_CRC_STRIP   |\n+\t\tDEV_RX_OFFLOAD_KEEP_CRC    |\n \t\tDEV_RX_OFFLOAD_SCATTER;\n \tif (max_rx_pktlen > ETHER_MAX_LEN)\n \t\trx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;\n@@ -1458,8 +1459,10 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,\n \trxq->rx_free_thresh = rx_conf->rx_free_thresh;\n \trxq->queue_id = queue_idx;\n \trxq->port_id = dev->data->port_id;\n-\trxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads &\n-\t\tDEV_RX_OFFLOAD_CRC_STRIP) ? 0 : ETHER_CRC_LEN);\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\trxq->crc_len = ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n \n \trxq->rdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDT(queue_idx));\n \trxq->rdh_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDH(queue_idx));\n@@ -1792,9 +1795,10 @@ eth_em_rx_init(struct rte_eth_dev *dev)\n \t\t * Reset crc_len in case it was changed after queue setup by a\n \t\t *  call to configure\n \t\t */\n-\t\trxq->crc_len =\n-\t\t\t(uint8_t)(dev->data->dev_conf.rxmode.offloads &\n-\t\t\t\tDEV_RX_OFFLOAD_CRC_STRIP ? 0 : ETHER_CRC_LEN);\n+\t\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\t\trxq->crc_len = ETHER_CRC_LEN;\n+\t\telse\n+\t\t\trxq->crc_len = 0;\n \n \t\tbus_addr = rxq->rx_ring_phys_addr;\n \t\tE1000_WRITE_REG(hw, E1000_RDLEN(i),\n@@ -1873,10 +1877,10 @@ eth_em_rx_init(struct rte_eth_dev *dev)\n \t}\n \n \t/* Setup the Receive Control Register. */\n-\tif (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)\n-\t\trctl |= E1000_RCTL_SECRC; /* Strip Ethernet CRC. */\n-\telse\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n \t\trctl &= ~E1000_RCTL_SECRC; /* Do not Strip Ethernet CRC. */\n+\telse\n+\t\trctl |= E1000_RCTL_SECRC; /* Strip Ethernet CRC. */\n \n \trctl &= ~(3 << E1000_RCTL_MO_SHIFT);\n \trctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_LBM_NO |\ndiff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c\nindex edc7be319..5c62445fe 100644\n--- a/drivers/net/e1000/igb_ethdev.c\n+++ b/drivers/net/e1000/igb_ethdev.c\n@@ -3194,12 +3194,12 @@ igbvf_dev_configure(struct rte_eth_dev *dev)\n \t * Keep the persistent behavior the same as Host PF\n \t */\n #ifndef RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC\n-\tif (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\tif (rte_eth_dev_is_keep_crc(conf->rxmode.offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"VF can't disable HW CRC Strip\");\n \t\tconf->rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\n #else\n-\tif (conf->rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n+\tif (!rte_eth_dev_is_keep_crc(conf->rxmode.offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"VF can't enable HW CRC Strip\");\n \t\tconf->rxmode.offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\ndiff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c\nindex 5f729f271..db594c1a3 100644\n--- a/drivers/net/e1000/igb_rxtx.c\n+++ b/drivers/net/e1000/igb_rxtx.c\n@@ -1639,6 +1639,7 @@ igb_get_rx_port_offloads_capa(struct rte_eth_dev *dev)\n \t\t\t  DEV_RX_OFFLOAD_TCP_CKSUM   |\n \t\t\t  DEV_RX_OFFLOAD_JUMBO_FRAME |\n \t\t\t  DEV_RX_OFFLOAD_CRC_STRIP   |\n+\t\t\t  DEV_RX_OFFLOAD_KEEP_CRC    |\n \t\t\t  DEV_RX_OFFLOAD_SCATTER;\n \n \treturn rx_offload_capa;\n@@ -1720,8 +1721,10 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,\n \trxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?\n \t\tqueue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);\n \trxq->port_id = dev->data->port_id;\n-\trxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads &\n-\t\t\tDEV_RX_OFFLOAD_CRC_STRIP) ? 0 : ETHER_CRC_LEN);\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\trxq->crc_len = ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n \n \t/*\n \t *  Allocate RX ring hardware descriptors. A memzone large enough to\n@@ -2371,8 +2374,10 @@ eth_igb_rx_init(struct rte_eth_dev *dev)\n \t\t * Reset crc_len in case it was changed after queue setup by a\n \t\t *  call to configure\n \t\t */\n-\t\trxq->crc_len = (uint8_t)(dev->data->dev_conf.rxmode.offloads &\n-\t\t\t\tDEV_RX_OFFLOAD_CRC_STRIP ? 0 : ETHER_CRC_LEN);\n+\t\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\t\trxq->crc_len = ETHER_CRC_LEN;\n+\t\telse\n+\t\t\trxq->crc_len = 0;\n \n \t\tbus_addr = rxq->rx_ring_phys_addr;\n \t\tE1000_WRITE_REG(hw, E1000_RDLEN(rxq->reg_idx),\n@@ -2501,10 +2506,10 @@ eth_igb_rx_init(struct rte_eth_dev *dev)\n \tE1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);\n \n \t/* Setup the Receive Control Register. */\n-\tif (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n-\t\trctl |= E1000_RCTL_SECRC; /* Strip Ethernet CRC. */\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads)) {\n+\t\trctl &= ~E1000_RCTL_SECRC; /* Do not Strip Ethernet CRC. */\n \n-\t\t/* set STRCRC bit in all queues */\n+\t\t/* clear STRCRC bit in all queues */\n \t\tif (hw->mac.type == e1000_i350 ||\n \t\t    hw->mac.type == e1000_i210 ||\n \t\t    hw->mac.type == e1000_i211 ||\n@@ -2513,14 +2518,14 @@ eth_igb_rx_init(struct rte_eth_dev *dev)\n \t\t\t\trxq = dev->data->rx_queues[i];\n \t\t\t\tuint32_t dvmolr = E1000_READ_REG(hw,\n \t\t\t\t\tE1000_DVMOLR(rxq->reg_idx));\n-\t\t\t\tdvmolr |= E1000_DVMOLR_STRCRC;\n+\t\t\t\tdvmolr &= ~E1000_DVMOLR_STRCRC;\n \t\t\t\tE1000_WRITE_REG(hw, E1000_DVMOLR(rxq->reg_idx), dvmolr);\n \t\t\t}\n \t\t}\n \t} else {\n-\t\trctl &= ~E1000_RCTL_SECRC; /* Do not Strip Ethernet CRC. */\n+\t\trctl |= E1000_RCTL_SECRC; /* Strip Ethernet CRC. */\n \n-\t\t/* clear STRCRC bit in all queues */\n+\t\t/* set STRCRC bit in all queues */\n \t\tif (hw->mac.type == e1000_i350 ||\n \t\t    hw->mac.type == e1000_i210 ||\n \t\t    hw->mac.type == e1000_i211 ||\n@@ -2529,7 +2534,7 @@ eth_igb_rx_init(struct rte_eth_dev *dev)\n \t\t\t\trxq = dev->data->rx_queues[i];\n \t\t\t\tuint32_t dvmolr = E1000_READ_REG(hw,\n \t\t\t\t\tE1000_DVMOLR(rxq->reg_idx));\n-\t\t\t\tdvmolr &= ~E1000_DVMOLR_STRCRC;\n+\t\t\t\tdvmolr |= E1000_DVMOLR_STRCRC;\n \t\t\t\tE1000_WRITE_REG(hw, E1000_DVMOLR(rxq->reg_idx), dvmolr);\n \t\t\t}\n \t\t}\ndiff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c\nindex 3ff1b0e0f..2b354dc15 100644\n--- a/drivers/net/fm10k/fm10k_ethdev.c\n+++ b/drivers/net/fm10k/fm10k_ethdev.c\n@@ -451,8 +451,10 @@ fm10k_dev_configure(struct rte_eth_dev *dev)\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\tif ((dev->data->dev_conf.rxmode.offloads &\n-\t     DEV_RX_OFFLOAD_CRC_STRIP) == 0)\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n \t\tPMD_INIT_LOG(WARNING, \"fm10k always strip CRC\");\n \n \t/* multipe queue mode checking */\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 13c5d3296..1276bb207 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -3327,6 +3327,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t\tDEV_RX_OFFLOAD_TCP_CKSUM |\n \t\tDEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |\n \t\tDEV_RX_OFFLOAD_CRC_STRIP |\n+\t\tDEV_RX_OFFLOAD_KEEP_CRC |\n \t\tDEV_RX_OFFLOAD_VLAN_EXTEND |\n \t\tDEV_RX_OFFLOAD_VLAN_FILTER |\n \t\tDEV_RX_OFFLOAD_JUMBO_FRAME;\ndiff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c\nindex 804e44530..520655bbe 100644\n--- a/drivers/net/i40e/i40e_ethdev_vf.c\n+++ b/drivers/net/i40e/i40e_ethdev_vf.c\n@@ -1536,7 +1536,7 @@ i40evf_dev_configure(struct rte_eth_dev *dev)\n \t/* For non-DPDK PF drivers, VF has no ability to disable HW\n \t * CRC strip, and is implicitly enabled by the PF.\n \t */\n-\tif (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\tif (rte_eth_dev_is_keep_crc(conf->rxmode.offloads)) {\n \t\tvf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n \t\tif ((vf->version_major == VIRTCHNL_VERSION_MAJOR) &&\n \t\t    (vf->version_minor <= VIRTCHNL_VERSION_MINOR)) {\n@@ -2200,6 +2200,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t\tDEV_RX_OFFLOAD_TCP_CKSUM |\n \t\tDEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |\n \t\tDEV_RX_OFFLOAD_CRC_STRIP |\n+\t\tDEV_RX_OFFLOAD_KEEP_CRC |\n \t\tDEV_RX_OFFLOAD_SCATTER |\n \t\tDEV_RX_OFFLOAD_JUMBO_FRAME |\n \t\tDEV_RX_OFFLOAD_VLAN_FILTER;\ndiff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c\nindex 6032d5541..4c3a2924f 100644\n--- a/drivers/net/i40e/i40e_rxtx.c\n+++ b/drivers/net/i40e/i40e_rxtx.c\n@@ -1829,8 +1829,10 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,\n \trxq->queue_id = queue_idx;\n \trxq->reg_idx = reg_idx;\n \trxq->port_id = dev->data->port_id;\n-\trxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads &\n-\t\t\tDEV_RX_OFFLOAD_CRC_STRIP) ? 0 : ETHER_CRC_LEN);\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\trxq->crc_len = ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n \trxq->drop_en = rx_conf->rx_drop_en;\n \trxq->vsi = vsi;\n \trxq->rx_deferred_start = rx_conf->rx_deferred_start;\ndiff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 87d2ad090..60b7f038f 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -4991,12 +4991,12 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)\n \t * Keep the persistent behavior the same as Host PF\n \t */\n #ifndef RTE_LIBRTE_IXGBE_PF_DISABLE_STRIP_CRC\n-\tif (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\tif (rte_eth_dev_is_keep_crc(conf->rxmode.offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"VF can't disable HW CRC Strip\");\n \t\tconf->rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\n #else\n-\tif (conf->rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n+\tif (!rte_eth_dev_is_keep_crc(conf->rxmode.offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"VF can't enable HW CRC Strip\");\n \t\tconf->rxmode.offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\ndiff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c\nindex de7ed3676..da861accf 100644\n--- a/drivers/net/ixgbe/ixgbe_ipsec.c\n+++ b/drivers/net/ixgbe/ixgbe_ipsec.c\n@@ -609,7 +609,7 @@ ixgbe_crypto_enable_ipsec(struct rte_eth_dev *dev)\n \t\tPMD_DRV_LOG(ERR, \"RSC and IPsec not supported\");\n \t\treturn -1;\n \t}\n-\tif (!(rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\tif (rte_eth_dev_is_keep_crc(rx_offloads)) {\n \t\tPMD_DRV_LOG(ERR, \"HW CRC strip needs to be enabled for IPsec\");\n \t\treturn -1;\n \t}\ndiff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c\nindex 3e13d26ae..b7b1d6be4 100644\n--- a/drivers/net/ixgbe/ixgbe_rxtx.c\n+++ b/drivers/net/ixgbe/ixgbe_rxtx.c\n@@ -2849,6 +2849,7 @@ ixgbe_get_rx_port_offloads(struct rte_eth_dev *dev)\n \t\t   DEV_RX_OFFLOAD_UDP_CKSUM   |\n \t\t   DEV_RX_OFFLOAD_TCP_CKSUM   |\n \t\t   DEV_RX_OFFLOAD_CRC_STRIP   |\n+\t\t   DEV_RX_OFFLOAD_KEEP_CRC    |\n \t\t   DEV_RX_OFFLOAD_JUMBO_FRAME |\n \t\t   DEV_RX_OFFLOAD_SCATTER;\n \n@@ -2935,8 +2936,10 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,\n \trxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?\n \t\tqueue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);\n \trxq->port_id = dev->data->port_id;\n-\trxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads &\n-\t\tDEV_RX_OFFLOAD_CRC_STRIP) ? 0 : ETHER_CRC_LEN);\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads))\n+\t\trxq->crc_len = ETHER_CRC_LEN;\n+\telse\n+\t\trxq->crc_len = 0;\n \trxq->drop_en = rx_conf->rx_drop_en;\n \trxq->rx_deferred_start = rx_conf->rx_deferred_start;\n \trxq->offloads = offloads;\n@@ -4702,7 +4705,7 @@ ixgbe_set_rsc(struct rte_eth_dev *dev)\n \n \t/* RSC global configuration (chapter 4.6.7.2.1 of 82599 Spec) */\n \n-\tif (!(rx_conf->offloads & DEV_RX_OFFLOAD_CRC_STRIP) &&\n+\tif (rte_eth_dev_is_keep_crc(rx_conf->offloads) &&\n \t     (rx_conf->offloads & DEV_RX_OFFLOAD_TCP_LRO)) {\n \t\t/*\n \t\t * According to chapter of 4.6.7.2.1 of the Spec Rev.\n@@ -4851,10 +4854,10 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)\n \t * Configure CRC stripping, if any.\n \t */\n \thlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);\n-\tif (rx_conf->offloads & DEV_RX_OFFLOAD_CRC_STRIP)\n-\t\thlreg0 |= IXGBE_HLREG0_RXCRCSTRP;\n-\telse\n+\tif (rte_eth_dev_is_keep_crc(rx_conf->offloads))\n \t\thlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;\n+\telse\n+\t\thlreg0 |= IXGBE_HLREG0_RXCRCSTRP;\n \n \t/*\n \t * Configure jumbo frame support, if any.\n@@ -4892,8 +4895,8 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)\n \t\t * Reset crc_len in case it was changed after queue setup by a\n \t\t * call to configure.\n \t\t */\n-\t\trxq->crc_len = (rx_conf->offloads & DEV_RX_OFFLOAD_CRC_STRIP) ?\n-\t\t\t\t0 : ETHER_CRC_LEN;\n+\t\trxq->crc_len = rte_eth_dev_is_keep_crc(rx_conf->offloads) ?\n+\t\t\t\tETHER_CRC_LEN : 0;\n \n \t\t/* Setup the Base and Length of the Rx Descriptor Rings */\n \t\tbus_addr = rxq->rx_ring_phys_addr;\n@@ -4962,10 +4965,10 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)\n \tif (hw->mac.type == ixgbe_mac_82599EB ||\n \t    hw->mac.type == ixgbe_mac_X540) {\n \t\trdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);\n-\t\tif (rx_conf->offloads & DEV_RX_OFFLOAD_CRC_STRIP)\n-\t\t\trdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;\n-\t\telse\n+\t\tif (rte_eth_dev_is_keep_crc(rx_conf->offloads))\n \t\t\trdrxctl &= ~IXGBE_RDRXCTL_CRCSTRIP;\n+\t\telse\n+\t\t\trdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;\n \t\trdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;\n \t\tIXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);\n \t}\ndiff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c\nindex ab63ea427..04cab248e 100644\n--- a/drivers/net/kni/rte_eth_kni.c\n+++ b/drivers/net/kni/rte_eth_kni.c\n@@ -207,6 +207,7 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused,\n \tdev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT;\n \tdev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT;\n \tdev_info->min_rx_bufsize = 0;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c\nindex 87688c1c7..d223e15cb 100644\n--- a/drivers/net/mlx4/mlx4_rxq.c\n+++ b/drivers/net/mlx4/mlx4_rxq.c\n@@ -672,7 +672,8 @@ uint64_t\n mlx4_get_rx_queue_offloads(struct priv *priv)\n {\n \tuint64_t offloads = DEV_RX_OFFLOAD_SCATTER |\n-\t\t\t    DEV_RX_OFFLOAD_CRC_STRIP;\n+\t\t\t    DEV_RX_OFFLOAD_CRC_STRIP |\n+\t\t\t    DEV_RX_OFFLOAD_KEEP_CRC;\n \n \tif (priv->hw_csum)\n \t\toffloads |= DEV_RX_OFFLOAD_CHECKSUM;\n@@ -771,16 +772,16 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,\n \t\t     (void *)dev, idx, desc);\n \t}\n \t/* By default, FCS (CRC) is stripped by hardware. */\n-\tif (offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n-\t\tcrc_present = 0;\n-\t} else if (priv->hw_fcs_strip) {\n-\t\tcrc_present = 1;\n-\t} else {\n-\t\tWARN(\"%p: CRC stripping has been disabled but will still\"\n-\t\t     \" be performed by hardware, make sure MLNX_OFED and\"\n-\t\t     \" firmware are up to date\",\n-\t\t     (void *)dev);\n-\t\tcrc_present = 0;\n+\tcrc_present = 0;\n+\tif (rte_eth_dev_is_keep_crc(offloads)) {\n+\t\tif (priv->hw_fcs_strip) {\n+\t\t\tcrc_present = 1;\n+\t\t} else {\n+\t\t\tWARN(\"%p: CRC stripping has been disabled but will still\"\n+\t\t\t     \" be performed by hardware, make sure MLNX_OFED and\"\n+\t\t\t     \" firmware are up to date\",\n+\t\t\t     (void *)dev);\n+\t\t}\n \t}\n \tDEBUG(\"%p: CRC stripping is %s, %u bytes will be subtracted from\"\n \t      \" incoming frames to hide it\",\ndiff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c\nindex de3f869ed..28cf168aa 100644\n--- a/drivers/net/mlx5/mlx5_rxq.c\n+++ b/drivers/net/mlx5/mlx5_rxq.c\n@@ -388,6 +388,9 @@ mlx5_get_rx_queue_offloads(struct rte_eth_dev *dev)\n \n \tif (config->hw_fcs_strip)\n \t\toffloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n+\telse\n+\t\toffloads |= DEV_RX_OFFLOAD_KEEP_CRC;\n+\n \tif (config->hw_csum)\n \t\toffloads |= (DEV_RX_OFFLOAD_IPV4_CKSUM |\n \t\t\t     DEV_RX_OFFLOAD_UDP_CKSUM |\n@@ -1419,17 +1422,17 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,\n \t/* Configure VLAN stripping. */\n \ttmpl->rxq.vlan_strip = !!(offloads & DEV_RX_OFFLOAD_VLAN_STRIP);\n \t/* By default, FCS (CRC) is stripped by hardware. */\n-\tif (offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n-\t\ttmpl->rxq.crc_present = 0;\n-\t} else if (config->hw_fcs_strip) {\n-\t\ttmpl->rxq.crc_present = 1;\n-\t} else {\n-\t\tDRV_LOG(WARNING,\n-\t\t\t\"port %u CRC stripping has been disabled but will\"\n-\t\t\t\" still be performed by hardware, make sure MLNX_OFED\"\n-\t\t\t\" and firmware are up to date\",\n-\t\t\tdev->data->port_id);\n-\t\ttmpl->rxq.crc_present = 0;\n+\ttmpl->rxq.crc_present = 0;\n+\tif (rte_eth_dev_is_keep_crc(offloads)) {\n+\t\tif (config->hw_fcs_strip) {\n+\t\t\ttmpl->rxq.crc_present = 1;\n+\t\t} else {\n+\t\t\tDRV_LOG(WARNING,\n+\t\t\t\t\"port %u CRC stripping has been disabled but will\"\n+\t\t\t\t\" still be performed by hardware, make sure MLNX_OFED\"\n+\t\t\t\t\" and firmware are up to date\",\n+\t\t\t\tdev->data->port_id);\n+\t\t}\n \t}\n \tDRV_LOG(DEBUG,\n \t\t\"port %u CRC stripping is %s, %u bytes will be subtracted from\"\ndiff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c\nindex d5eb1fe69..74d067ac2 100644\n--- a/drivers/net/mvpp2/mrvl_ethdev.c\n+++ b/drivers/net/mvpp2/mrvl_ethdev.c\n@@ -314,9 +314,11 @@ mrvl_dev_configure(struct rte_eth_dev *dev)\n \t\treturn -EINVAL;\n \t}\n \n-\tif (!(dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n-\t\tMRVL_LOG(INFO,\n-\t\t\t\"L2 CRC stripping is always enabled in hw\");\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(dev->data->dev_conf.rxmode.offloads)) {\n+\t\tMRVL_LOG(INFO, \"L2 CRC stripping is always enabled in hw\");\n \t\tdev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\n \ndiff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c\nindex 36586969f..f8c65c1c6 100644\n--- a/drivers/net/nfp/nfp_net.c\n+++ b/drivers/net/nfp/nfp_net.c\n@@ -411,8 +411,10 @@ nfp_net_configure(struct rte_eth_dev *dev)\n \t\treturn -EINVAL;\n \t}\n \n-\t/* Checking RX offloads */\n-\tif (!(rxmode->offloads & DEV_RX_OFFLOAD_CRC_STRIP))\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(rxmode->offloads))\n \t\tPMD_INIT_LOG(INFO, \"HW does strip CRC. No configurable!\");\n \n \treturn 0;\n@@ -1166,7 +1168,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t\t\t\t\t     DEV_RX_OFFLOAD_UDP_CKSUM |\n \t\t\t\t\t     DEV_RX_OFFLOAD_TCP_CKSUM;\n \n-\tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;\n+\tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME |\n+\t\t\t\t     DEV_RX_OFFLOAD_KEEP_CRC;\n \n \tif (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)\n \t\tdev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT;\ndiff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c\nindex 1d2e6b9e9..38c8c42bc 100644\n--- a/drivers/net/null/rte_eth_null.c\n+++ b/drivers/net/null/rte_eth_null.c\n@@ -305,6 +305,7 @@ eth_dev_info(struct rte_eth_dev *dev,\n \tdev_info->min_rx_bufsize = 0;\n \tdev_info->reta_size = internals->reta_size;\n \tdev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c\nindex 1eb453b21..b0541f115 100644\n--- a/drivers/net/octeontx/octeontx_ethdev.c\n+++ b/drivers/net/octeontx/octeontx_ethdev.c\n@@ -283,7 +283,10 @@ octeontx_dev_configure(struct rte_eth_dev *dev)\n \t\treturn -EINVAL;\n \t}\n \n-\tif (!(rxmode->offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(rxmode->offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"can't disable hw crc strip\");\n \t\trxmode->offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\ndiff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c\nindex 6bd4a7d79..626e89833 100644\n--- a/drivers/net/pcap/rte_eth_pcap.c\n+++ b/drivers/net/pcap/rte_eth_pcap.c\n@@ -538,6 +538,7 @@ eth_dev_info(struct rte_eth_dev *dev,\n \tdev_info->max_rx_queues = dev->data->nb_rx_queues;\n \tdev_info->max_tx_queues = dev->data->nb_tx_queues;\n \tdev_info->min_rx_bufsize = 0;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c\nindex 7a63d0564..e5e8ea4a3 100644\n--- a/drivers/net/qede/qede_ethdev.c\n+++ b/drivers/net/qede/qede_ethdev.c\n@@ -1532,6 +1532,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,\n \t\t\t\t     DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |\n \t\t\t\t     DEV_RX_OFFLOAD_TCP_LRO\t|\n \t\t\t\t     DEV_RX_OFFLOAD_CRC_STRIP\t|\n+\t\t\t\t     DEV_RX_OFFLOAD_KEEP_CRC    |\n \t\t\t\t     DEV_RX_OFFLOAD_SCATTER\t|\n \t\t\t\t     DEV_RX_OFFLOAD_JUMBO_FRAME |\n \t\t\t\t     DEV_RX_OFFLOAD_VLAN_FILTER |\n@@ -1562,6 +1563,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,\n \t\t.rx_drop_en = 1,\n \t\t/* The below RX offloads are always enabled */\n \t\t.offloads = (DEV_RX_OFFLOAD_CRC_STRIP  |\n+\t\t\t     DEV_RX_OFFLOAD_KEEP_CRC   |\n \t\t\t     DEV_RX_OFFLOAD_IPV4_CKSUM |\n \t\t\t     DEV_RX_OFFLOAD_TCP_CKSUM  |\n \t\t\t     DEV_RX_OFFLOAD_UDP_CKSUM),\ndiff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c\nindex 35b837c3f..5aa48da42 100644\n--- a/drivers/net/ring/rte_eth_ring.c\n+++ b/drivers/net/ring/rte_eth_ring.c\n@@ -164,6 +164,7 @@ eth_dev_info(struct rte_eth_dev *dev,\n \tdev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;\n \tdev_info->max_tx_queues = (uint16_t)internals->max_tx_queues;\n \tdev_info->min_rx_bufsize = 0;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c\nindex cc76a5b15..cdcc70b26 100644\n--- a/drivers/net/sfc/sfc_rx.c\n+++ b/drivers/net/sfc/sfc_rx.c\n@@ -1443,7 +1443,10 @@ sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode)\n \t\trc = EINVAL;\n \t}\n \n-\tif (~rxmode->offloads & DEV_RX_OFFLOAD_CRC_STRIP) {\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(rxmode->offloads)) {\n \t\tsfc_warn(sa, \"FCS stripping cannot be disabled - always on\");\n \t\trxmode->offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t\trxmode->hw_strip_crc = 1;\ndiff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c\nindex 6b3c13e5c..9360cf6c3 100644\n--- a/drivers/net/softnic/rte_eth_softnic.c\n+++ b/drivers/net/softnic/rte_eth_softnic.c\n@@ -65,6 +65,7 @@ static const struct rte_eth_dev_info pmd_dev_info = {\n \t\t.nb_min = 0,\n \t\t.nb_align = 1,\n \t},\n+\t.rx_offload_capa = DEV_RX_OFFLOAD_CRC_STRIP,\n };\n \n static int pmd_softnic_logtype;\ndiff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c\nindex 910c64d04..829ad13fa 100644\n--- a/drivers/net/szedata2/rte_eth_szedata2.c\n+++ b/drivers/net/szedata2/rte_eth_szedata2.c\n@@ -1056,7 +1056,8 @@ eth_dev_info(struct rte_eth_dev *dev,\n \tdev_info->max_rx_queues = internals->max_rx_queues;\n \tdev_info->max_tx_queues = internals->max_tx_queues;\n \tdev_info->min_rx_bufsize = 0;\n-\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_SCATTER;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_SCATTER |\n+\t\t\t\t    DEV_RX_OFFLOAD_CRC_STRIP;\n \tdev_info->tx_offload_capa = 0;\n \tdev_info->rx_queue_offload_capa = 0;\n \tdev_info->tx_queue_offload_capa = 0;\ndiff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c\nindex 99fcd516b..f92f38f42 100644\n--- a/drivers/net/thunderx/nicvf_ethdev.c\n+++ b/drivers/net/thunderx/nicvf_ethdev.c\n@@ -1887,7 +1887,10 @@ nicvf_dev_configure(struct rte_eth_dev *dev)\n \t\treturn -EINVAL;\n \t}\n \n-\tif ((rxmode->offloads & DEV_RX_OFFLOAD_CRC_STRIP) == 0) {\n+\t/* KEEP_CRC offload flag is not supported by PMD\n+\t * can remove the below block when DEV_RX_OFFLOAD_CRC_STRIP removed\n+\t */\n+\tif (rte_eth_dev_is_keep_crc(rxmode->offloads)) {\n \t\tPMD_INIT_LOG(NOTICE, \"Can't disable hw crc strip\");\n \t\trxmode->offloads |= DEV_RX_OFFLOAD_CRC_STRIP;\n \t}\ndiff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c\nindex ba9d768a0..eb1afe691 100644\n--- a/drivers/net/vhost/rte_eth_vhost.c\n+++ b/drivers/net/vhost/rte_eth_vhost.c\n@@ -1070,7 +1070,8 @@ eth_dev_info(struct rte_eth_dev *dev,\n \n \tdev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |\n \t\t\t\tDEV_TX_OFFLOAD_VLAN_INSERT;\n-\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\t\t\t    DEV_RX_OFFLOAD_CRC_STRIP;\n }\n \n static int\ndiff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex df50a571a..b629cd45d 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -2127,7 +2127,8 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \t};\n \n \thost_features = VTPCI_OPS(hw)->get_features(hw);\n-\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\t\t\t    DEV_RX_OFFLOAD_CRC_STRIP;\n \tif (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) {\n \t\tdev_info->rx_offload_capa |=\n \t\t\tDEV_RX_OFFLOAD_TCP_CKSUM |\ndiff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c\nindex ba932ff27..95b465952 100644\n--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c\n+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c\n@@ -57,7 +57,8 @@\n \t DEV_RX_OFFLOAD_UDP_CKSUM |\t\\\n \t DEV_RX_OFFLOAD_TCP_CKSUM |\t\\\n \t DEV_RX_OFFLOAD_TCP_LRO |\t\\\n-\t DEV_RX_OFFLOAD_JUMBO_FRAME)\n+\t DEV_RX_OFFLOAD_JUMBO_FRAME |   \\\n+\t DEV_RX_OFFLOAD_CRC_STRIP)\n \n static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);\n static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex a9977df97..5d0132223 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -129,6 +129,7 @@ static const struct {\n \tRTE_RX_OFFLOAD_BIT2STR(SCATTER),\n \tRTE_RX_OFFLOAD_BIT2STR(TIMESTAMP),\n \tRTE_RX_OFFLOAD_BIT2STR(SECURITY),\n+\tRTE_RX_OFFLOAD_BIT2STR(KEEP_CRC),\n };\n \n #undef RTE_RX_OFFLOAD_BIT2STR\n@@ -1185,6 +1186,14 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\treturn -EINVAL;\n \t}\n \n+\tif ((local_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) &&\n+\t\t\t(local_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)) {\n+\t\tethdev_log(ERR,\n+\t\t\t\"Port id=%u not allowed to set both CRC STRIP and KEEP CRC offload flags\\n\",\n+\t\t\tport_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/* Check that device supports requested rss hash functions. */\n \tif ((dev_info.flow_type_rss_offloads |\n \t     dev_conf->rx_adv_conf.rss_conf.rss_hf) !=\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex 36e3984ea..1f5652e85 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -939,6 +939,11 @@ struct rte_eth_conf {\n #define DEV_RX_OFFLOAD_SCATTER\t\t0x00002000\n #define DEV_RX_OFFLOAD_TIMESTAMP\t0x00004000\n #define DEV_RX_OFFLOAD_SECURITY         0x00008000\n+\n+/* Invalid to set both DEV_RX_OFFLOAD_CRC_STRIP and DEV_RX_OFFLOAD_KEEP_CRC\n+ * No DEV_RX_OFFLOAD_CRC_STRIP flag means keep CRC\n+ */\n+#define DEV_RX_OFFLOAD_KEEP_CRC\t\t0x00010000\n #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \\\n \t\t\t\t DEV_RX_OFFLOAD_UDP_CKSUM | \\\n \t\t\t\t DEV_RX_OFFLOAD_TCP_CKSUM)\ndiff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h\nindex c9c825e3f..09a42f8c2 100644\n--- a/lib/librte_ethdev/rte_ethdev_driver.h\n+++ b/lib/librte_ethdev/rte_ethdev_driver.h\n@@ -325,6 +325,26 @@ typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);\n int __rte_experimental\n rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);\n \n+/**\n+ * PMD helper function to check if keeping CRC is requested\n+ *\n+ * @param rx_offloads\n+ *   offloads variable\n+ *\n+ * @return\n+ *   Return positive if keeping CRC is requested,\n+ *   zero if stripping CRC is requested\n+ */\n+static inline int\n+rte_eth_dev_is_keep_crc(uint64_t rx_offloads)\n+{\n+\tif (rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP)\n+\t\treturn 0;\n+\n+\t/* no KEEP_CRC or CRC_STRIP offload flags means keep CRC */\n+\treturn 1;\n+}\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": []
}