net/virtio: improve queue init error path
[dpdk.git] / drivers / net / cxgbe / cxgbevf_main.c
index 82f40f3..f639612 100644 (file)
@@ -3,14 +3,15 @@
  * All rights reserved.
  */
 
-#include <rte_ethdev_driver.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
 #include <rte_malloc.h>
 
 #include "base/common.h"
 #include "base/t4_regs.h"
 #include "base/t4_msg.h"
 #include "cxgbe.h"
+#include "cxgbe_pfvf.h"
 #include "mps_tcam.h"
 
 /*
@@ -122,11 +123,18 @@ static int adap_init0vf(struct adapter *adapter)
         * firmware won't understand this and we'll just get
         * unencapsulated messages ...
         */
-       param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) |
-               V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP);
+       param = CXGBE_FW_PARAM_PFVF(CPLFW4MSG_ENCAP);
        val = 1;
        t4vf_set_params(adapter, 1, &param, &val);
 
+       /* Query for max number of packets that can be coalesced for Tx */
+       param = CXGBE_FW_PARAM_PFVF(MAX_PKTS_PER_ETH_TX_PKTS_WR);
+       err = t4vf_query_params(adapter, 1, &param, &val);
+       if (!err && val > 0)
+               adapter->params.max_tx_coalesce_num = val;
+       else
+               adapter->params.max_tx_coalesce_num = ETH_COALESCE_VF_PKT_NUM;
+
        /*
         * Grab our Virtual Interface resource allocation, extract the
         * features that we're interested in and do a bit of sanity testing on
@@ -268,7 +276,10 @@ allocate_mac:
                }
        }
 
-       cxgbe_cfg_queues(adapter->eth_dev);
+       err = cxgbe_cfg_queues(adapter->eth_dev);
+       if (err)
+               goto out_free;
+
        cxgbe_print_adapter_info(adapter);
        cxgbe_print_port_info(adapter);
 
@@ -283,6 +294,8 @@ allocate_mac:
        return 0;
 
 out_free:
+       cxgbe_cfg_queues_free(adapter);
+
        for_each_port(adapter, i) {
                pi = adap2pinfo(adapter, i);
                if (pi->viid != 0)