net/sfc: support flow item TCP in transfer rules
[dpdk.git] / drivers / net / sfc / sfc.c
index 8fa790d..a4fe495 100644 (file)
@@ -857,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);
 
@@ -878,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:
@@ -918,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);
@@ -1251,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;
+}