net/sfc: support flow item TCP in transfer rules
[dpdk.git] / drivers / net / sfc / sfc.c
index b41db65..a4fe495 100644 (file)
@@ -667,6 +667,9 @@ sfc_mem_bar_init(struct sfc_adapter *sa, const efx_bar_region_t *mem_ebrp)
        ebp->esb_rid = mem_ebrp->ebr_index;
        ebp->esb_dev = pci_dev;
        ebp->esb_base = res->addr;
+
+       sa->fcw_offset = mem_ebrp->ebr_offset;
+
        return 0;
 }
 
@@ -805,7 +808,8 @@ sfc_attach(struct sfc_adapter *sa)
            (sfc_dp_tx_offload_capa(sa->priv.dp_tx) &
             (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
              DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) != 0) {
-               sa->tso_encap = encp->enc_fw_assisted_tso_v2_encap_enabled;
+               sa->tso_encap = encp->enc_fw_assisted_tso_v2_encap_enabled ||
+                               encp->enc_tso_v3_enabled;
                if (!sa->tso_encap)
                        sfc_info(sa, "Encapsulated TSO support isn't available on this adapter");
        }
@@ -853,6 +857,10 @@ sfc_attach(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_filter_attach;
 
+       rc = sfc_mae_attach(sa);
+       if (rc != 0)
+               goto fail_mae_attach;
+
        sfc_log_init(sa, "fini nic");
        efx_nic_fini(enp);
 
@@ -874,6 +882,9 @@ sfc_attach(struct sfc_adapter *sa)
 
 fail_sriov_vswitch_create:
        sfc_flow_fini(sa);
+       sfc_mae_detach(sa);
+
+fail_mae_attach:
        sfc_filter_detach(sa);
 
 fail_filter_attach:
@@ -914,6 +925,7 @@ sfc_detach(struct sfc_adapter *sa)
 
        sfc_flow_fini(sa);
 
+       sfc_mae_detach(sa);
        sfc_filter_detach(sa);
        sfc_rss_detach(sa);
        sfc_port_detach(sa);
@@ -1247,3 +1259,47 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
 
        return ret;
 }
+
+struct sfc_hw_switch_id {
+       char    board_sn[RTE_SIZEOF_FIELD(efx_nic_board_info_t, enbi_serial)];
+};
+
+int
+sfc_hw_switch_id_init(struct sfc_adapter *sa,
+                     struct sfc_hw_switch_id **idp)
+{
+       efx_nic_board_info_t board_info;
+       struct sfc_hw_switch_id *id;
+       int rc;
+
+       if (idp == NULL)
+               return EINVAL;
+
+       id = rte_zmalloc("sfc_hw_switch_id", sizeof(*id), 0);
+       if (id == NULL)
+               return ENOMEM;
+
+       rc = efx_nic_get_board_info(sa->nic, &board_info);
+       if (rc != 0)
+               return rc;
+
+       memcpy(id->board_sn, board_info.enbi_serial, sizeof(id->board_sn));
+
+       *idp = id;
+
+       return 0;
+}
+
+void
+sfc_hw_switch_id_fini(__rte_unused struct sfc_adapter *sa,
+                     struct sfc_hw_switch_id *id)
+{
+       rte_free(id);
+}
+
+bool
+sfc_hw_switch_ids_equal(const struct sfc_hw_switch_id *left,
+                       const struct sfc_hw_switch_id *right)
+{
+       return strcmp(left->board_sn, right->board_sn) == 0;
+}