MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ulp_ctx_attach

Function ulp_ctx_attach

dpdk/drivers/net/bnxt/tf_ulp/bnxt_ulp.c:1241–1299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1239}
1240
1241static int32_t
1242ulp_ctx_attach(struct bnxt *bp,
1243 struct bnxt_ulp_session_state *session)
1244{
1245 int32_t rc = 0;
1246 uint32_t flags, dev_id = BNXT_ULP_DEVICE_ID_LAST;
1247 struct tf *tfp;
1248 uint8_t app_id;
1249
1250 /* Increment the ulp context data reference count usage. */
1251 bp->ulp_ctx->cfg_data = session->cfg_data;
1252 bp->ulp_ctx->cfg_data->ref_cnt++;
1253
1254 /* update the session details in bnxt tfp */
1255 tfp = bnxt_ulp_bp_tfp_get(bp, BNXT_ULP_SESSION_TYPE_DEFAULT);
1256 tfp->session = bnxt_ulp_session_tfp_get(session,
1257 BNXT_ULP_SESSION_TYPE_DEFAULT);
1258
1259 /* Add the context to the context entries list */
1260 rc = bnxt_ulp_cntxt_list_add(bp->ulp_ctx);
1261 if (rc) {
1262 BNXT_TF_DBG(ERR, "Failed to add the context list entry\n");
1263 return -EINVAL;
1264 }
1265
1266 /*
1267 * The supported flag will be set during the init. Use it now to
1268 * know if we should go through the attach.
1269 */
1270 rc = bnxt_ulp_cntxt_app_id_get(bp->ulp_ctx, &app_id);
1271 if (rc) {
1272 BNXT_TF_DBG(ERR, "Unable to get the app id from ulp.\n");
1273 return -EINVAL;
1274 }
1275
1276 rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id);
1277 if (rc) {
1278 BNXT_TF_DBG(ERR, "Unable do get the dev_id.\n");
1279 return -EINVAL;
1280 }
1281
1282 flags = bp->ulp_ctx->cfg_data->ulp_flags;
1283 if (ULP_APP_DEV_UNSUPPORTED_ENABLED(flags)) {
1284 BNXT_TF_DBG(ERR, "APP ID %d, Device ID: 0x%x not supported.\n",
1285 app_id, dev_id);
1286 return -EINVAL;
1287 }
1288
1289 /* Create a TF Client */
1290 rc = ulp_ctx_session_open(bp, session);
1291 if (rc) {
1292 PMD_DRV_LOG(ERR, "Failed to open ctxt session, rc:%d\n", rc);
1293 tfp->session = NULL;
1294 return rc;
1295 }
1296 tfp = bnxt_ulp_bp_tfp_get(bp, BNXT_ULP_SESSION_TYPE_DEFAULT);
1297 bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, BNXT_ULP_SESSION_TYPE_DEFAULT, tfp);
1298 return rc;

Callers 1

bnxt_ulp_port_initFunction · 0.85

Calls 7

bnxt_ulp_bp_tfp_getFunction · 0.85
bnxt_ulp_session_tfp_getFunction · 0.85
bnxt_ulp_cntxt_list_addFunction · 0.85
ulp_ctx_session_openFunction · 0.85
bnxt_ulp_cntxt_tfp_setFunction · 0.85

Tested by

no test coverage detected