net/ice: enable Rx timestamp on flex descriptor
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index 96e8d18..02ea2e7 100644 (file)
@@ -399,6 +399,24 @@ mlx5_is_hpf(struct rte_eth_dev *dev)
               MLX5_REPRESENTOR_REPR(-1) == repr;
 }
 
+/**
+ * Decide whether representor ID is a SF port representor.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   Non-zero if HPF, otherwise 0.
+ */
+bool
+mlx5_is_sf_repr(struct rte_eth_dev *dev)
+{
+       struct mlx5_priv *priv = dev->data->dev_private;
+       int type = MLX5_REPRESENTOR_TYPE(priv->representor_id);
+
+       return priv->representor != 0 && type == RTE_ETH_REPRESENTOR_SF;
+}
+
 /**
  * Initialize the ASO aging management structure.
  *
@@ -1236,6 +1254,8 @@ error:
        MLX5_ASSERT(sh);
        if (sh->cnt_id_tbl)
                mlx5_l3t_destroy(sh->cnt_id_tbl);
+       if (sh->share_cache.cache.table)
+               mlx5_mr_btree_free(&sh->share_cache.cache);
        if (sh->tis)
                claim_zero(mlx5_devx_cmd_destroy(sh->tis));
        if (sh->td)
@@ -1562,6 +1582,11 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                priv->rxqs_n = 0;
                priv->rxqs = NULL;
        }
+       if (priv->representor) {
+               /* Each representor has a dedicated interrupts handler */
+               mlx5_free(dev->intr_handle);
+               dev->intr_handle = NULL;
+       }
        if (priv->txqs != NULL) {
                /* XXX race condition if mlx5_tx_burst() is still running. */
                rte_delay_us_sleep(1000);
@@ -1738,6 +1763,7 @@ const struct eth_dev_ops mlx5_dev_sec_ops = {
        .xstats_get_names = mlx5_xstats_get_names,
        .fw_version_get = mlx5_fw_version_get,
        .dev_infos_get = mlx5_dev_infos_get,
+       .representor_info_get = mlx5_representor_info_get,
        .read_clock = mlx5_txpp_read_clock,
        .rx_queue_start = mlx5_rx_queue_start,
        .rx_queue_stop = mlx5_rx_queue_stop,
@@ -1771,6 +1797,7 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
        .xstats_get_names = mlx5_xstats_get_names,
        .fw_version_get = mlx5_fw_version_get,
        .dev_infos_get = mlx5_dev_infos_get,
+       .representor_info_get = mlx5_representor_info_get,
        .read_clock = mlx5_txpp_read_clock,
        .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get,
        .vlan_filter_set = mlx5_vlan_filter_set,
@@ -2272,7 +2299,8 @@ rte_pmd_mlx5_get_dyn_flag_names(char *names[], unsigned int n)
  */
 int
 mlx5_dev_check_sibling_config(struct mlx5_priv *priv,
-                             struct mlx5_dev_config *config)
+                             struct mlx5_dev_config *config,
+                             struct rte_device *dpdk_dev)
 {
        struct mlx5_dev_ctx_shared *sh = priv->sh;
        struct mlx5_dev_config *sh_conf = NULL;
@@ -2283,7 +2311,7 @@ mlx5_dev_check_sibling_config(struct mlx5_priv *priv,
        if (sh->refcnt == 1)
                return 0;
        /* Find the device with shared context. */
-       MLX5_ETH_FOREACH_DEV(port_id, NULL) {
+       MLX5_ETH_FOREACH_DEV(port_id, dpdk_dev) {
                struct mlx5_priv *opriv =
                        rte_eth_devices[port_id].data->dev_private;
 
@@ -2335,7 +2363,10 @@ mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev)
                    (dev->device == odev ||
                     (dev->device->driver &&
                     dev->device->driver->name &&
-                    !strcmp(dev->device->driver->name, MLX5_PCI_DRIVER_NAME))))
+                    ((strcmp(dev->device->driver->name,
+                             MLX5_PCI_DRIVER_NAME) == 0) ||
+                     (strcmp(dev->device->driver->name,
+                             MLX5_AUXILIARY_DRIVER_NAME) == 0)))))
                        break;
                port_id++;
        }
@@ -2355,7 +2386,7 @@ mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev)
  * @return
  *   0 on success, the function cannot fail.
  */
-static int
+int
 mlx5_net_remove(struct rte_device *dev)
 {
        uint16_t port_id;