net/bnxt: add TruFlow core identifier
[dpdk.git] / drivers / net / sfc / base / ef10_nic.c
index 0cf9ddd..d1802da 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright (c) 2012-2018 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2012-2019 Solarflare Communications Inc.
  */
 
 #include "efx.h"
@@ -233,8 +233,6 @@ efx_mcdi_vadaptor_alloc(
                MC_CMD_VADAPTOR_ALLOC_OUT_LEN);
        efx_rc_t rc;
 
-       EFSYS_ASSERT3U(enp->en_vport_id, ==, EVB_PORT_ID_NULL);
-
        req.emr_cmd = MC_CMD_VADAPTOR_ALLOC;
        req.emr_in_buf = payload;
        req.emr_in_length = MC_CMD_VADAPTOR_ALLOC_IN_LEN;
@@ -1110,6 +1108,12 @@ ef10_get_datapath_caps(
        else
                encp->enc_datapath_cap_evb = B_FALSE;
 
+       /* Check if the firmware supports vport reconfiguration */
+       if (CAP_FLAGS1(req, VPORT_RECONFIGURE))
+               encp->enc_vport_reconfigure_supported = B_TRUE;
+       else
+               encp->enc_vport_reconfigure_supported = B_FALSE;
+
        /* Check if the firmware supports VLAN insertion */
        if (CAP_FLAGS1(req, TX_VLAN_INSERTION))
                encp->enc_hw_tx_insert_vlan_enabled = B_TRUE;
@@ -2517,9 +2521,21 @@ ef10_nic_fini(
 {
        uint32_t i;
        efx_rc_t rc;
+       boolean_t do_vadaptor_free = B_TRUE;
 
-       (void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
-       enp->en_vport_id = 0;
+#if EFSYS_OPT_EVB
+       if (enp->en_vswitchp != NULL) {
+               /*
+                * For SR-IOV the vAdaptor is freed with the vswitch,
+                * so do not free it here.
+                */
+               do_vadaptor_free = B_FALSE;
+       }
+#endif
+       if (do_vadaptor_free != B_FALSE) {
+               (void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
+               enp->en_vport_id = EVB_PORT_ID_NULL;
+       }
 
        /* Unlink piobufs from extra VIs in WC mapping */
        if (enp->en_arch.ef10.ena_piobuf_count > 0) {