net/mlx5: make VLAN network interface thread safe
[dpdk.git] / drivers / net / bnxt / tf_core / tf_core.c
index 0dbde1d..0f49a00 100644 (file)
@@ -34,7 +34,8 @@ tf_open_session(struct tf *tfp,
         * side. It is assumed that the Firmware will be supported if
         * firmware open session succeeds.
         */
-       if (parms->device_type != TF_DEVICE_TYPE_WH) {
+       if (parms->device_type != TF_DEVICE_TYPE_WH &&
+           parms->device_type != TF_DEVICE_TYPE_SR) {
                TFP_DRV_LOG(ERR,
                            "Unsupported device type %d\n",
                            parms->device_type);
@@ -302,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,
        int rc = 0;
        struct tf_session *tfs;
        struct tf_dev_info *dev;
-       struct tf_dev_global_cfg_parms gparms = { 0 };
 
        TF_CHECK_PARMS2(tfp, parms);
 
@@ -341,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,
                return -EOPNOTSUPP;
        }
 
-       gparms.dir = parms->dir;
-       gparms.type = parms->type;
-       gparms.offset = parms->offset;
-       gparms.config = parms->config;
-       gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-       rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);
+       rc = dev->ops->tf_dev_get_global_cfg(tfp, parms);
        if (rc) {
                TFP_DRV_LOG(ERR,
                            "%s: Global Cfg get failed, rc:%s\n",
@@ -370,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,
        int rc = 0;
        struct tf_session *tfs;
        struct tf_dev_info *dev;
-       struct tf_dev_global_cfg_parms gparms = { 0 };
 
        TF_CHECK_PARMS2(tfp, parms);
 
@@ -409,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,
                return -EOPNOTSUPP;
        }
 
-       gparms.dir = parms->dir;
-       gparms.type = parms->type;
-       gparms.offset = parms->offset;
-       gparms.config = parms->config;
-       gparms.config_sz_in_bytes = parms->config_sz_in_bytes;
-       rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);
+       rc = dev->ops->tf_dev_set_global_cfg(tfp, parms);
        if (rc) {
                TFP_DRV_LOG(ERR,
                            "%s: Global Cfg set failed, rc:%s\n",
@@ -1351,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,
 
        return rc;
 }
+int
+tf_map_tbl_scope(struct tf *tfp,
+                  struct tf_map_tbl_scope_parms *parms)
+{
+       struct tf_session *tfs;
+       struct tf_dev_info *dev;
+       int rc;
+
+       TF_CHECK_PARMS2(tfp, parms);
+
+       /* Retrieve the session information */
+       rc = tf_session_get_session(tfp, &tfs);
+       if (rc) {
+               TFP_DRV_LOG(ERR,
+                           "Failed to lookup session, rc:%s\n",
+                           strerror(-rc));
+               return rc;
+       }
+
+       /* Retrieve the device information */
+       rc = tf_session_get_device(tfs, &dev);
+       if (rc) {
+               TFP_DRV_LOG(ERR,
+                           "Failed to lookup device, rc:%s\n",
+                           strerror(-rc));
+               return rc;
+       }
+
+       if (dev->ops->tf_dev_map_tbl_scope != NULL) {
+               rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);
+       } else {
+               TFP_DRV_LOG(ERR,
+                           "Map table scope not supported by device\n");
+               return -EINVAL;
+       }
+
+       return rc;
+}
 
 int
 tf_free_tbl_scope(struct tf *tfp,