net/sfc: support link status change interrupt
[dpdk.git] / drivers / net / sfc / sfc.c
index dad8c2b..6b3dc48 100644 (file)
@@ -37,6 +37,8 @@
 #include "sfc.h"
 #include "sfc_log.h"
 #include "sfc_ev.h"
+#include "sfc_rx.h"
+#include "sfc_tx.h"
 
 
 int
@@ -114,7 +116,9 @@ sfc_check_conf(struct sfc_adapter *sa)
                rc = EINVAL;
        }
 
-       if (conf->intr_conf.lsc != 0) {
+       if ((conf->intr_conf.lsc != 0) &&
+           (sa->intr.type != EFX_INTR_LINE) &&
+           (sa->intr.type != EFX_INTR_MESSAGE)) {
                sfc_err(sa, "Link status change interrupt not supported");
                rc = EINVAL;
        }
@@ -270,10 +274,24 @@ sfc_start(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_port_start;
 
+       rc = sfc_rx_start(sa);
+       if (rc != 0)
+               goto fail_rx_start;
+
+       rc = sfc_tx_start(sa);
+       if (rc != 0)
+               goto fail_tx_start;
+
        sa->state = SFC_ADAPTER_STARTED;
        sfc_log_init(sa, "done");
        return 0;
 
+fail_tx_start:
+       sfc_rx_stop(sa);
+
+fail_rx_start:
+       sfc_port_stop(sa);
+
 fail_port_start:
        sfc_ev_stop(sa);
 
@@ -312,6 +330,8 @@ sfc_stop(struct sfc_adapter *sa)
 
        sa->state = SFC_ADAPTER_STOPPING;
 
+       sfc_tx_stop(sa);
+       sfc_rx_stop(sa);
        sfc_port_stop(sa);
        sfc_ev_stop(sa);
        sfc_intr_stop(sa);
@@ -349,10 +369,24 @@ sfc_configure(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_port_init;
 
+       rc = sfc_rx_init(sa);
+       if (rc != 0)
+               goto fail_rx_init;
+
+       rc = sfc_tx_init(sa);
+       if (rc != 0)
+               goto fail_tx_init;
+
        sa->state = SFC_ADAPTER_CONFIGURED;
        sfc_log_init(sa, "done");
        return 0;
 
+fail_tx_init:
+       sfc_rx_fini(sa);
+
+fail_rx_init:
+       sfc_port_fini(sa);
+
 fail_port_init:
        sfc_ev_fini(sa);
 
@@ -376,6 +410,8 @@ sfc_close(struct sfc_adapter *sa)
        SFC_ASSERT(sa->state == SFC_ADAPTER_CONFIGURED);
        sa->state = SFC_ADAPTER_CLOSING;
 
+       sfc_tx_fini(sa);
+       sfc_rx_fini(sa);
        sfc_port_fini(sa);
        sfc_ev_fini(sa);
        sfc_intr_fini(sa);
@@ -421,6 +457,7 @@ int
 sfc_attach(struct sfc_adapter *sa)
 {
        struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(sa->eth_dev);
+       const efx_nic_cfg_t *encp;
        efx_nic_t *enp;
        int rc;
 
@@ -471,6 +508,10 @@ sfc_attach(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_estimate_rsrc_limits;
 
+       encp = efx_nic_cfg_get(sa->nic);
+       sa->txq_max_entries = encp->enc_txq_max_ndescs;
+       SFC_ASSERT(rte_is_power_of_2(sa->txq_max_entries));
+
        rc = sfc_intr_attach(sa);
        if (rc != 0)
                goto fail_intr_attach;