X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_core.c;h=97e7952a9c890eb60ec2931b96723ce287f931e4;hb=7eec575a223daf436ee68a91642ffb7ed8cdbd49;hp=0f119b45fe5d333eb3e17c10493d3ee1b4e2c819;hpb=a11f87d3b2caac31623b9f0d190bd93465b27153;p=dpdk.git diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 0f119b45fe..97e7952a9c 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -49,9 +49,22 @@ tf_open_session(struct tf *tfp, &slot, &device); if (rc != 4) { - TFP_DRV_LOG(ERR, + /* PCI Domain not provided (optional in DPDK), thus we + * force domain to 0 and recheck. + */ + domain = 0; + + /* Check parsing of bus/slot/device */ + rc = sscanf(parms->ctrl_chan_name, + "%x:%x.%d", + &bus, + &slot, + &device); + if (rc != 3) { + TFP_DRV_LOG(ERR, "Failed to scan device ctrl_chan_name\n"); - return -EINVAL; + return -EINVAL; + } } parms->session_id.internal.domain = domain; @@ -521,6 +534,7 @@ tf_free_identifier(struct tf *tfp, fparms.dir = parms->dir; fparms.type = parms->ident_type; fparms.id = parms->id; + fparms.ref_cnt = &parms->ref_cnt; rc = dev->ops->tf_dev_free_ident(tfp, &fparms); if (rc) { TFP_DRV_LOG(ERR, @@ -533,6 +547,66 @@ tf_free_identifier(struct tf *tfp, return 0; } +int +tf_search_identifier(struct tf *tfp, + struct tf_search_identifier_parms *parms) +{ + int rc; + struct tf_session *tfs; + struct tf_dev_info *dev; + struct tf_ident_search_parms sparms; + + TF_CHECK_PARMS2(tfp, parms); + + /* Can't do static initialization due to UT enum check */ + memset(&sparms, 0, sizeof(struct tf_ident_search_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_search_ident == NULL) { + rc = -EOPNOTSUPP; + TFP_DRV_LOG(ERR, + "%s: Operation not supported, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + sparms.dir = parms->dir; + sparms.type = parms->ident_type; + sparms.search_id = parms->search_id; + sparms.hit = &parms->hit; + sparms.ref_cnt = &parms->ref_cnt; + rc = dev->ops->tf_dev_search_ident(tfp, &sparms); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Identifier search failed, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + return 0; +} + int tf_alloc_tcam_entry(struct tf *tfp, struct tf_alloc_tcam_entry_parms *parms) @@ -540,10 +614,12 @@ tf_alloc_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; - struct tf_tcam_alloc_parms aparms = { 0 }; + struct tf_tcam_alloc_parms aparms; TF_CHECK_PARMS2(tfp, parms); + memset(&aparms, 0, sizeof(struct tf_tcam_alloc_parms)); + /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { @@ -598,10 +674,13 @@ tf_set_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; - struct tf_tcam_set_parms sparms = { 0 }; + struct tf_tcam_set_parms sparms; TF_CHECK_PARMS2(tfp, parms); + memset(&sparms, 0, sizeof(struct tf_tcam_set_parms)); + + /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) { @@ -667,10 +746,12 @@ tf_free_tcam_entry(struct tf *tfp, int rc; struct tf_session *tfs; struct tf_dev_info *dev; - struct tf_tcam_free_parms fparms = { 0 }; + struct tf_tcam_free_parms fparms; TF_CHECK_PARMS2(tfp, parms); + memset(&fparms, 0, sizeof(struct tf_tcam_free_parms)); + /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); if (rc) {