net/dpaa2: fix the ethdev offload checks
[dpdk.git] / drivers / net / enic / enic_main.c
index d9bc7fd..2a22697 100644 (file)
@@ -200,15 +200,14 @@ void enic_init_vnic_resources(struct enic *enic)
        unsigned int error_interrupt_enable = 1;
        unsigned int error_interrupt_offset = 0;
        unsigned int rxq_interrupt_enable = 0;
-       unsigned int rxq_interrupt_offset;
+       unsigned int rxq_interrupt_offset = ENICPMD_RXQ_INTR_OFFSET;
        unsigned int index = 0;
        unsigned int cq_idx;
        struct vnic_rq *data_rq;
 
-       if (enic->rte_dev->data->dev_conf.intr_conf.rxq) {
+       if (enic->rte_dev->data->dev_conf.intr_conf.rxq)
                rxq_interrupt_enable = 1;
-               rxq_interrupt_offset = ENICPMD_RXQ_INTR_OFFSET;
-       }
+
        for (index = 0; index < enic->rq_count; index++) {
                cq_idx = enic_cq_rq(enic, enic_rte_rq_idx_to_sop_idx(index));
 
@@ -244,6 +243,9 @@ void enic_init_vnic_resources(struct enic *enic)
                        enic_cq_wq(enic, index),
                        error_interrupt_enable,
                        error_interrupt_offset);
+               /* Compute unsupported ol flags for enic_prep_pkts() */
+               enic->wq[index].tx_offload_notsup_mask =
+                       PKT_TX_OFFLOAD_MASK ^ enic->tx_offload_mask;
 
                cq_idx = enic_cq_wq(enic, index);
                vnic_cq_init(&enic->cq[cq_idx],
@@ -1546,6 +1548,27 @@ static int enic_dev_init(struct enic *enic)
        /* set up link status checking */
        vnic_dev_notify_set(enic->vdev, -1); /* No Intr for notify */
 
+       enic->overlay_offload = false;
+       if (!enic->disable_overlay && enic->vxlan &&
+           /* 'VXLAN feature' enables VXLAN, NVGRE, and GENEVE. */
+           vnic_dev_overlay_offload_ctrl(enic->vdev,
+                                         OVERLAY_FEATURE_VXLAN,
+                                         OVERLAY_OFFLOAD_ENABLE) == 0) {
+               enic->tx_offload_capa |=
+                       DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+                       DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+                       DEV_TX_OFFLOAD_VXLAN_TNL_TSO;
+               /*
+                * Do not add PKT_TX_OUTER_{IPV4,IPV6} as they are not
+                * 'offload' flags (i.e. not part of PKT_TX_OFFLOAD_MASK).
+                */
+               enic->tx_offload_mask |=
+                       PKT_TX_OUTER_IP_CKSUM |
+                       PKT_TX_TUNNEL_MASK;
+               enic->overlay_offload = true;
+               dev_info(enic, "Overlay offload is enabled\n");
+       }
+
        return 0;
 
 }