X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_core.c;h=24d49096a77b10040035e147cb4c2868d7c25795;hb=4c3a535ede4a6d6aa0ade6d15d3a58a0ad9b5fdd;hp=ca3280b6b1adce157a790ca5f683d1d7f65b3be6;hpb=7d5d5b877582ee30e64946ee788d21d50d03ae2e;p=dpdk.git diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index ca3280b6b1..24d49096a7 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -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); @@ -43,7 +44,7 @@ tf_open_session(struct tf *tfp, /* Verify control channel and build the beginning of session_id */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot, @@ -56,7 +57,7 @@ tf_open_session(struct tf *tfp, /* Check parsing of bus/slot/device */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x.%d", + "%x:%x.%u", &bus, &slot, &device); @@ -75,7 +76,6 @@ tf_open_session(struct tf *tfp, /* Session vs session client is decided in * tf_session_open_session() */ - printf("TF_OPEN, %s\n", parms->ctrl_chan_name); rc = tf_session_open_session(tfp, &oparms); /* Logging handled by tf_session_open_session */ if (rc) @@ -102,7 +102,7 @@ tf_attach_session(struct tf *tfp, /* Verify control channel */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot, @@ -115,7 +115,7 @@ tf_attach_session(struct tf *tfp, /* Verify 'attach' channel */ rc = sscanf(parms->attach_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot, @@ -303,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); @@ -342,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", @@ -371,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); @@ -410,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", @@ -953,6 +941,71 @@ tf_alloc_tbl_entry(struct tf *tfp, return 0; } +int +tf_search_tbl_entry(struct tf *tfp, + struct tf_search_tbl_entry_parms *parms) +{ + int rc; + struct tf_session *tfs; + struct tf_dev_info *dev; + struct tf_tbl_alloc_search_parms sparms; + + TF_CHECK_PARMS2(tfp, parms); + + /* Retrieve the session information */ + rc = tf_session_get_session(tfp, &tfs); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to lookup session, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to lookup device, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + if (dev->ops->tf_dev_alloc_search_tbl == NULL) { + rc = -EOPNOTSUPP; + TFP_DRV_LOG(ERR, + "%s: Operation not supported, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms)); + sparms.dir = parms->dir; + sparms.type = parms->type; + sparms.result = parms->result; + sparms.result_sz_in_bytes = parms->result_sz_in_bytes; + sparms.alloc = parms->alloc; + sparms.tbl_scope_id = parms->tbl_scope_id; + rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: TBL allocation failed, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + /* Return the outputs from the search */ + parms->hit = sparms.hit; + parms->search_status = sparms.search_status; + parms->ref_cnt = sparms.ref_cnt; + parms->idx = sparms.idx; + + return 0; +} + int tf_free_tbl_entry(struct tf *tfp, struct tf_free_tbl_entry_parms *parms) @@ -1287,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,