src/dpdk/drivers/net/bnxt/tf_ulp/ulp_tun.c
static int32_t
ulp_post_process_first_inner_tun_flow(struct ulp_rte_parser_params *params,
				      struct bnxt_tun_cache_entry *tun_entry)
{
	struct ulp_per_port_flow_info *flow_info;
	int ret;

	ret = ulp_matcher_pattern_match(params, &params->class_id);
	if (ret != BNXT_TF_RC_SUCCESS)
		return BNXT_TF_RC_ERROR;

	ret = ulp_matcher_action_match(params, &params->act_tmpl);
	if (ret != BNXT_TF_RC_SUCCESS)
		return BNXT_TF_RC_ERROR;

	/* If Tunnel F2 flow comes first then we can't install it in the
	 * hardware, because, F2 flow will not have L2 context information.
	 * So, just cache the F2 information and program it in the context
	 * of F1 flow installation.
	 */
	flow_info = &tun_entry->tun_flow_info[params->port_id];
	memcpy(&flow_info->first_inner_tun_params, params,
	       sizeof(struct ulp_rte_parser_params));

	flow_info->first_tun_i_fid = params->fid;
	flow_info->state = BNXT_ULP_FLOW_STATE_TUN_I_CACHED;

	/* F1 and it's related F2s are correlated based on
	 * Tunnel Destination IP Address. It could be already set, if
	 * the inner flow got offloaded first.
	 */
	if (tun_entry->t_dst_ip_valid)
		goto done;
	if (ULP_BITMAP_ISSET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_O_IPV4))
		memcpy(&tun_entry->t_dst_ip,
		       &params->hdr_field[ULP_TUN_O_IPV4_DIP_INDEX].spec,
		       sizeof(rte_be32_t));
	else
		memcpy(tun_entry->t_dst_ip6,
		       &params->hdr_field[ULP_TUN_O_IPV6_DIP_INDEX].spec,
		       sizeof(tun_entry->t_dst_ip6));
	tun_entry->t_dst_ip_valid = true;

done:
	return BNXT_TF_RC_FID;
}
/* This function will be called if inner tunnel flow request comes before
 * outer tunnel flow request.
 */
This function will be called if inner tunnel flow request comes before
outer tunnel flow request.
This function will be called if inner tunnel flow request comes before outer tunnel flow request .
static int32_t
ulp_post_process_first_inner_tun_flow(struct ulp_rte_parser_params *params,
				      struct bnxt_tun_cache_entry *tun_entry)
{
	struct ulp_per_port_flow_info *flow_info;
	int ret;
	ret = ulp_matcher_pattern_match(params, &params->class_id);
	if (ret != BNXT_TF_RC_SUCCESS)
		return BNXT_TF_RC_ERROR;
	ret = ulp_matcher_action_match(params, &params->act_tmpl);
	if (ret != BNXT_TF_RC_SUCCESS)
		return BNXT_TF_RC_ERROR;
	flow_info = &tun_entry->tun_flow_info[params->port_id];
	memcpy(&flow_info->first_inner_tun_params, params,
	       sizeof(struct ulp_rte_parser_params));
	flow_info->first_tun_i_fid = params->fid;
	flow_info->state = BNXT_ULP_FLOW_STATE_TUN_I_CACHED;
	if (tun_entry->t_dst_ip_valid)
		goto done;
	if (ULP_BITMAP_ISSET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_O_IPV4))
		memcpy(&tun_entry->t_dst_ip,
		       &params->hdr_field[ULP_TUN_O_IPV4_DIP_INDEX].spec,
		       sizeof(rte_be32_t));
	else
		memcpy(tun_entry->t_dst_ip6,
		       &params->hdr_field[ULP_TUN_O_IPV6_DIP_INDEX].spec,
		       sizeof(tun_entry->t_dst_ip6));
	tun_entry->t_dst_ip_valid = true;
done:
	return BNXT_TF_RC_FID;
}
static int32_t ulp_post_process_first_inner_tun_flow ( struct ulp_rte_parser_params * params , struct bnxt_tun_cache_entry * tun_entry ) { struct ulp_per_port_flow_info * flow_info ; int ret ; ret = ulp_matcher_pattern_match ( params , & params -> class_id ) ; if ( ret != BNXT_TF_RC_SUCCESS ) return BNXT_TF_RC_ERROR ; ret = ulp_matcher_action_match ( params , & params -> act_tmpl ) ; if ( ret != BNXT_TF_RC_SUCCESS ) return BNXT_TF_RC_ERROR ; flow_info = & tun_entry -> tun_flow_info [ params -> port_id ] ; memcpy ( & flow_info -> first_inner_tun_params , params , sizeof ( struct ulp_rte_parser_params ) ) ; flow_info -> first_tun_i_fid = params -> fid ; flow_info -> state = BNXT_ULP_FLOW_STATE_TUN_I_CACHED ; if ( tun_entry -> t_dst_ip_valid ) goto done ; if ( ULP_BITMAP_ISSET ( params -> hdr_bitmap . bits , BNXT_ULP_HDR_BIT_O_IPV4 ) ) memcpy ( & tun_entry -> t_dst_ip , & params -> hdr_field [ ULP_TUN_O_IPV4_DIP_INDEX ] . spec , sizeof ( rte_be32_t ) ) ; else memcpy ( tun_entry -> t_dst_ip6 , & params -> hdr_field [ ULP_TUN_O_IPV6_DIP_INDEX ] . spec , sizeof ( tun_entry -> t_dst_ip6 ) ) ; tun_entry -> t_dst_ip_valid = true ; done : return BNXT_TF_RC_FID ; }
This function will be called if inner tunnel flow request comes before
 outer tunnel flow request.
This function will be called if inner tunnel flow request comes before outer tunnel flow request .
/* If Tunnel F2 flow comes first then we can't install it in the
	 * hardware, because, F2 flow will not have L2 context information.
	 * So, just cache the F2 information and program it in the context
	 * of F1 flow installation.
	 */ /* F1 and it's related F2s are correlated based on
	 * Tunnel Destination IP Address. It could be already set, if
	 * the inner flow got offloaded first.
	 */