src/dpdk/drivers/net/bnxt/tf_ulp/ulp_tun.c
static int32_t
ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
			   struct bnxt_tun_cache_entry *tun_entry,
			   uint16_t tun_idx)
{
	struct bnxt_ulp_mapper_create_parms mparms = { 0 };
	int ret;

	/* Reset the JUMP action bit in the action bitmap as we don't
	 * offload this action.
	 */
	ULP_BITMAP_RESET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_JUMP);

	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);

	ret = ulp_matcher_pattern_match(params, &params->class_id);
	if (ret != BNXT_TF_RC_SUCCESS)
		goto err;

	ret = ulp_matcher_action_match(params, &params->act_tmpl);
	if (ret != BNXT_TF_RC_SUCCESS)
		goto err;

	params->parent_flow = true;
	bnxt_ulp_init_mapper_params(&mparms, params,
				    BNXT_ULP_FDB_TYPE_REGULAR);
	mparms.tun_idx = tun_idx;

	/* Call the ulp mapper to create the flow in the hardware. */
	ret = ulp_mapper_flow_create(params->ulp_ctx, &mparms);
	if (ret)
		goto err;

	/* Store the tunnel dmac in the tunnel cache table and use it while
	 * programming tunnel flow F2.
	 */
	memcpy(tun_entry->t_dmac,
	       &params->hdr_field[ULP_TUN_O_DMAC_HDR_FIELD_INDEX].spec,
	       RTE_ETHER_ADDR_LEN);

	tun_entry->valid = true;
	tun_entry->tun_flow_info[params->port_id].state =
				BNXT_ULP_FLOW_STATE_TUN_O_OFFLD;
	tun_entry->outer_tun_flow_id = params->fid;

	/* F1 and it's related F2s are correlated based on
	 * Tunnel Destination IP Address.
	 */
	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;

err:
	memset(tun_entry, 0, sizeof(struct bnxt_tun_cache_entry));
	return BNXT_TF_RC_ERROR;
}
/* This function programs the outer tunnel flow in the hardware. */
This function programs the outer tunnel flow in the hardware.
This function programs the outer tunnel flow in the hardware .
static int32_t
ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
			   struct bnxt_tun_cache_entry *tun_entry,
			   uint16_t tun_idx)
{
	struct bnxt_ulp_mapper_create_parms mparms = { 0 };
	int ret;
	ULP_BITMAP_RESET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_JUMP);
	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
	ret = ulp_matcher_pattern_match(params, &params->class_id);
	if (ret != BNXT_TF_RC_SUCCESS)
		goto err;
	ret = ulp_matcher_action_match(params, &params->act_tmpl);
	if (ret != BNXT_TF_RC_SUCCESS)
		goto err;
	params->parent_flow = true;
	bnxt_ulp_init_mapper_params(&mparms, params,
				    BNXT_ULP_FDB_TYPE_REGULAR);
	mparms.tun_idx = tun_idx;
	ret = ulp_mapper_flow_create(params->ulp_ctx, &mparms);
	if (ret)
		goto err;
	memcpy(tun_entry->t_dmac,
	       &params->hdr_field[ULP_TUN_O_DMAC_HDR_FIELD_INDEX].spec,
	       RTE_ETHER_ADDR_LEN);
	tun_entry->valid = true;
	tun_entry->tun_flow_info[params->port_id].state =
				BNXT_ULP_FLOW_STATE_TUN_O_OFFLD;
	tun_entry->outer_tun_flow_id = params->fid;
	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;
err:
	memset(tun_entry, 0, sizeof(struct bnxt_tun_cache_entry));
	return BNXT_TF_RC_ERROR;
}
static int32_t ulp_install_outer_tun_flow ( struct ulp_rte_parser_params * params , struct bnxt_tun_cache_entry * tun_entry , uint16_t tun_idx ) { struct bnxt_ulp_mapper_create_parms mparms = { 0 } ; int ret ; ULP_BITMAP_RESET ( params -> act_bitmap . bits , BNXT_ULP_ACTION_BIT_JUMP ) ; ULP_BITMAP_SET ( params -> hdr_bitmap . bits , BNXT_ULP_HDR_BIT_F1 ) ; ret = ulp_matcher_pattern_match ( params , & params -> class_id ) ; if ( ret != BNXT_TF_RC_SUCCESS ) goto err ; ret = ulp_matcher_action_match ( params , & params -> act_tmpl ) ; if ( ret != BNXT_TF_RC_SUCCESS ) goto err ; params -> parent_flow = true ; bnxt_ulp_init_mapper_params ( & mparms , params , BNXT_ULP_FDB_TYPE_REGULAR ) ; mparms . tun_idx = tun_idx ; ret = ulp_mapper_flow_create ( params -> ulp_ctx , & mparms ) ; if ( ret ) goto err ; memcpy ( tun_entry -> t_dmac , & params -> hdr_field [ ULP_TUN_O_DMAC_HDR_FIELD_INDEX ] . spec , RTE_ETHER_ADDR_LEN ) ; tun_entry -> valid = true ; tun_entry -> tun_flow_info [ params -> port_id ] . state = BNXT_ULP_FLOW_STATE_TUN_O_OFFLD ; tun_entry -> outer_tun_flow_id = params -> fid ; 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 ; err : memset ( tun_entry , 0 , sizeof ( struct bnxt_tun_cache_entry ) ) ; return BNXT_TF_RC_ERROR ; }
This function programs the outer tunnel flow in the hardware.
This function programs the outer tunnel flow in the hardware .
/* Reset the JUMP action bit in the action bitmap as we don't
	 * offload this action.
	 */ /* Call the ulp mapper to create the flow in the hardware. */ /* Store the tunnel dmac in the tunnel cache table and use it while
	 * programming tunnel flow F2.
	 */ /* F1 and it's related F2s are correlated based on
	 * Tunnel Destination IP Address.
	 */