Rate This Document
Findability
Accuracy
Completeness
Readability

flexda_custom_update_ctx

Function

Updates the custom context.

Syntax

int flexda_custom_update_ctx(void *ctx, const struct flexda_custom_info_t *info)

Parameters

Parameter

Type

Input/Output

Description

ctx

void *

Input

Pointer to the custom context.

info

const struct flexda_custom_info_t *

Input

Information provided by dpak-ovs for flexda-ovs to read. For details, see Table 1.

Return value

int

Output

The function returns 0 upon successful execution; otherwise, it returns an error code.

Table 1 struct flexda_custom_info_t

Attribute Type

Attribute Name

Description

uint16_t

input_port_id

Source input port of the current packet in OVS offload.

dp_packet *

pkt

Current packet in OVS offload.

rte_flow_action *

src_actions

Actions of the current software flow table in OVS offload.

Example

int flexda_custom_update_ctx(void *ctx, flexda_custom_info_t info)
{
    // Update the custom context based on the actions of the current software flow table. For example, if POP_VLAN exists, set the vlan_poped flag bit in the custom context to 1.
    struct custom_packet_ctx *custom_ctx = (struct custom_packet_ctx *)ctx;
    struct rte_flow_action *actions = info.src_actions;
    for (int i = 0; i < 15; i++) {
        switch (action[i].type) {
            case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
                custom_ctx->vlan_poped = 1;
                break;
            default:
                break;
        }
    }
    return 0;
}