net/iavf: support CRC strip disabling
authorHaiyue Wang <haiyue.wang@intel.com>
Tue, 12 Jan 2021 08:13:00 +0000 (16:13 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 13 Jan 2021 17:51:58 +0000 (18:51 +0100)
The VF will check the PF's CRC strip capability firstly, then set the
'CRC strip disable' value in the queue configuration according to the
RX CRC offload setting.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_ethdev.c
drivers/net/iavf/iavf_rxtx.c
drivers/net/iavf/iavf_vchnl.c

index 7bf31d4..49e6dd1 100644 (file)
@@ -800,6 +800,9 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                DEV_TX_OFFLOAD_MULTI_SEGS |
                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
+       if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_CRC)
+               dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_KEEP_CRC;
+
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_free_thresh = IAVF_DEFAULT_RX_FREE_THRESH,
                .rx_drop_en = 0,
index 21d508b..d53d7b9 100644 (file)
@@ -550,11 +550,15 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
        rxq->rx_free_thresh = rx_free_thresh;
        rxq->queue_id = queue_idx;
        rxq->port_id = dev->data->port_id;
-       rxq->crc_len = 0; /* crc stripping by default */
        rxq->rx_deferred_start = rx_conf->rx_deferred_start;
        rxq->rx_hdr_len = 0;
        rxq->vsi = vsi;
 
+       if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+               rxq->crc_len = RTE_ETHER_CRC_LEN;
+       else
+               rxq->crc_len = 0;
+
        len = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
        rxq->rx_buf_len = RTE_ALIGN(len, (1 << IAVF_RXQ_CTX_DBUFF_SHIFT));
 
index 25d5cda..c33194c 100644 (file)
@@ -458,6 +458,7 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
                VIRTCHNL_VF_OFFLOAD_FDIR_PF |
                VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF |
                VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |
+               VIRTCHNL_VF_OFFLOAD_CRC |
                VIRTCHNL_VF_LARGE_NUM_QPAIRS;
 
        args.in_args = (uint8_t *)&caps;
@@ -853,7 +854,7 @@ iavf_configure_queues(struct iavf_adapter *adapter,
                vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc;
                vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
                vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len;
-
+               vc_qp->rxq.crc_disable = rxq[i]->crc_len != 0 ? 1 : 0;
 #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
                if (vf->vf_res->vf_cap_flags &
                    VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC &&