- struct tf_session_sram_resc_alloc_input req = { 0 };
- struct tf_session_sram_resc_alloc_output resp;
- struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);
-
- memset(&resp, 0, sizeof(resp));
-
- /* Populate the request */
- req.fw_session_id =
- tfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);
- req.flags = tfp_cpu_to_le_16(dir);
-
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_FULL_ACTION, req,
- full_action);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_MCG, req,
- mcg);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_ENCAP_8B, req,
- encap_8b);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_ENCAP_16B, req,
- encap_16b);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_ENCAP_64B, req,
- encap_64b);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_SP_SMAC, req,
- sp_smac);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_SP_SMAC_IPV4,
- req, sp_smac_ipv4);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_SP_SMAC_IPV6,
- req, sp_smac_ipv6);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_COUNTER_64B,
- req, counter_64b);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_NAT_SPORT, req,
- nat_sport);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_NAT_DPORT, req,
- nat_dport);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_NAT_S_IPV4, req,
- nat_s_ipv4);
- TF_SRAM_ALLOC_TO_REQ(sram_alloc, TF_RESC_TYPE_SRAM_NAT_D_IPV4, req,
- nat_d_ipv4);
-
- MSG_PREP(parms,
- TF_KONG_MB,
- HWRM_TF,
- HWRM_TFT_SESSION_SRAM_RESC_ALLOC,
- req,
- resp);
-
- rc = tfp_send_msg_tunneled(tfp, &parms);
- if (rc)
- return rc;
-
- /* Process the response */
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_FULL_ACTION,
- resp, full_action);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_MCG, resp,
- mcg);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_8B, resp,
- encap_8b);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_16B, resp,
- encap_16b);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_64B, resp,
- encap_64b);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC, resp,
- sp_smac);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV4,
- resp, sp_smac_ipv4);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV6,
- resp, sp_smac_ipv6);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_COUNTER_64B, resp,
- counter_64b);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_NAT_SPORT, resp,
- nat_sport);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_NAT_DPORT, resp,
- nat_dport);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_NAT_S_IPV4, resp,
- nat_s_ipv4);
- TF_SRAM_RESP_TO_ALLOC(sram_entry, TF_RESC_TYPE_SRAM_NAT_D_IPV4, resp,
- nat_d_ipv4);
-
- return tfp_le_to_cpu_32(parms.tf_resp_code);
-}
-
-/**
- * Sends session SRAM resource free request to TF Firmware
- */
-int
-tf_msg_session_sram_resc_free(struct tf *tfp __rte_unused,
- enum tf_dir dir,
- struct tf_rm_entry *sram_entry __rte_unused)
-{
- int rc;
- struct tfp_send_msg_parms parms = { 0 };
- struct tf_session_sram_resc_free_input req = { 0 };
- struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);
-
- /* Populate the request */
- req.fw_session_id =
- tfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);
- req.flags = tfp_cpu_to_le_16(dir);
-
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_FULL_ACTION, req,
- full_action);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_MCG, req,
- mcg);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_8B, req,
- encap_8b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_16B, req,
- encap_16b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_64B, req,
- encap_64b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC, req,
- sp_smac);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV4, req,
- sp_smac_ipv4);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV6, req,
- sp_smac_ipv6);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_COUNTER_64B, req,
- counter_64b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_SPORT, req,
- nat_sport);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_DPORT, req,
- nat_dport);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_S_IPV4, req,
- nat_s_ipv4);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_D_IPV4, req,
- nat_d_ipv4);
-
- MSG_PREP_NO_RESP(parms,
- TF_KONG_MB,
- HWRM_TF,
- HWRM_TFT_SESSION_SRAM_RESC_FREE,
- req);
-
- rc = tfp_send_msg_tunneled(tfp, &parms);
- if (rc)
- return rc;
-
- return tfp_le_to_cpu_32(parms.tf_resp_code);
-}
-
-/**
- * Sends session SRAM resource flush request to TF Firmware
- */
-int
-tf_msg_session_sram_resc_flush(struct tf *tfp,
- enum tf_dir dir,
- struct tf_rm_entry *sram_entry)
-{
- int rc;
- struct tfp_send_msg_parms parms = { 0 };
- struct tf_session_sram_resc_free_input req = { 0 };
- struct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);
-
- /* Populate the request */
- req.fw_session_id =
- tfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);
- req.flags = tfp_cpu_to_le_16(dir);
-
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_FULL_ACTION, req,
- full_action);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_MCG, req,
- mcg);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_8B, req,
- encap_8b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_16B, req,
- encap_16b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_ENCAP_64B, req,
- encap_64b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC, req,
- sp_smac);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV4, req,
- sp_smac_ipv4);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_SP_SMAC_IPV6, req,
- sp_smac_ipv6);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_COUNTER_64B, req,
- counter_64b);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_SPORT, req,
- nat_sport);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_DPORT, req,
- nat_dport);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_S_IPV4, req,
- nat_s_ipv4);
- TF_SRAM_FREE_TO_REQ(sram_entry, TF_RESC_TYPE_SRAM_NAT_D_IPV4, req,
- nat_d_ipv4);
-
- MSG_PREP_NO_RESP(parms,
- TF_KONG_MB,
- TF_TYPE_TRUFLOW,
- HWRM_TFT_SESSION_SRAM_RESC_FLUSH,
- req);
-
- rc = tfp_send_msg_tunneled(tfp, &parms);
- if (rc)
- return rc;
-
- return tfp_le_to_cpu_32(parms.tf_resp_code);
-}
-
-int
-tf_msg_session_resc_qcaps(struct tf *tfp,
- enum tf_dir dir,
- uint16_t size,
- struct tf_rm_resc_req_entry *query,
- enum tf_rm_resc_resv_strategy *resv_strategy)
-{
- int rc;
- int i;
- struct tfp_send_msg_parms parms = { 0 };
- struct hwrm_tf_session_resc_qcaps_input req = { 0 };
- struct hwrm_tf_session_resc_qcaps_output resp = { 0 };