/* Disable NAT feature */
(void)bnxt_ulp_global_cfg_update(bp, TF_DIR_RX, TF_TUNNEL_ENCAP,
TF_TUNNEL_ENCAP_NAT,
- (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |
- BNXT_ULP_NAT_INNER_L2_HEADER_DMAC),
- 0);
+ BNXT_ULP_NAT_OUTER_MOST_FLAGS, 0);
(void)bnxt_ulp_global_cfg_update(bp, TF_DIR_TX, TF_TUNNEL_ENCAP,
TF_TUNNEL_ENCAP_NAT,
- (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |
- BNXT_ULP_NAT_INNER_L2_HEADER_DMAC),
- 0);
+ BNXT_ULP_NAT_OUTER_MOST_FLAGS, 0);
/* Delete the ulp context and tf session and free the ulp context */
ulp_ctx_deinit(bp, session);
*/
rc = bnxt_ulp_global_cfg_update(bp, TF_DIR_RX, TF_TUNNEL_ENCAP,
TF_TUNNEL_ENCAP_NAT,
- (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |
- BNXT_ULP_NAT_INNER_L2_HEADER_DMAC), 1);
+ BNXT_ULP_NAT_OUTER_MOST_FLAGS, 1);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to set rx global configuration\n");
goto jump_to_error;
rc = bnxt_ulp_global_cfg_update(bp, TF_DIR_TX, TF_TUNNEL_ENCAP,
TF_TUNNEL_ENCAP_NAT,
- (BNXT_ULP_NAT_INNER_L2_HEADER_SMAC |
- BNXT_ULP_NAT_INNER_L2_HEADER_DMAC), 1);
+ BNXT_ULP_NAT_OUTER_MOST_FLAGS, 1);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to set tx global configuration\n");
goto jump_to_error;
uint32_t val_size = 0, field_size = 0;
uint64_t act_bit;
uint8_t act_val;
+ uint64_t hdr_bit;
switch (fld->result_opcode) {
case BNXT_ULP_MAPPER_OPC_SET_TO_CONSTANT:
return -EINVAL;
}
break;
+ case BNXT_ULP_MAPPER_OPC_IF_HDR_BIT_THEN_CONST_ELSE_CONST:
+ if (!ulp_operand_read(fld->result_operand,
+ (uint8_t *)&hdr_bit, sizeof(uint64_t))) {
+ BNXT_TF_DBG(ERR, "%s operand read failed\n", name);
+ return -EINVAL;
+ }
+ hdr_bit = tfp_be_to_cpu_64(hdr_bit);
+ if (ULP_BITMAP_ISSET(parms->hdr_bitmap->bits, hdr_bit)) {
+ /* Header bit is set so consider operand_true */
+ val = fld->result_operand_true;
+ } else {
+ /* Header bit is not set, use the operand false */
+ val = fld->result_operand_false;
+ }
+ if (!ulp_blob_push(blob, val, fld->field_bit_size)) {
+ BNXT_TF_DBG(ERR, "%s failed to add field\n",
+ name);
+ return -EINVAL;
+ }
+ break;
default:
BNXT_TF_DBG(ERR, "invalid result mapper opcode 0x%x\n",
fld->result_opcode);
},
{
.field_bit_size = 4,
- .result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_CONSTANT,
- .result_operand = {
- BNXT_ULP_SYM_DECAP_FUNC_THRU_L2,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+ .result_opcode = BNXT_ULP_MAPPER_OPC_IF_HDR_BIT_THEN_CONST_ELSE_CONST,
+ .result_operand = {
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 56) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 48) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 40) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 32) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 24) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 16) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 8) & 0xff,
+ (uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN & 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .result_operand_true = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .result_operand_false = {0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
},
{
.field_bit_size = 12,
},
{
.field_bit_size = 4,
- .result_opcode = BNXT_ULP_MAPPER_OPC_SET_TO_CONSTANT,
- .result_operand = {
- BNXT_ULP_SYM_DECAP_FUNC_THRU_L2,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+ .result_opcode = BNXT_ULP_MAPPER_OPC_IF_HDR_BIT_THEN_CONST_ELSE_CONST,
+ .result_operand = {
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 56) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 48) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 40) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 32) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 24) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 16) & 0xff,
+ ((uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN >> 8) & 0xff,
+ (uint64_t)BNXT_ULP_HDR_BIT_T_VXLAN & 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .result_operand_true = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .result_operand_false = {0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
},
{
.field_bit_size = 12,