鲲鹏社区首页
中文
注册
开发者
我要评分
获取效率
正确性
完整性
易理解
在线提单
论坛求助

flexda_custom_update_ctx

接口功能

用户更新自定义上下文。

接口格式

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

参数说明

参数名

参数类型

入参/出参

说明

ctx

void *

入参

自定义上下文的地址。

info

const struct flexda_custom_info_t *

入参

dpak-ovs提供flexda-ovs读取使用的信息。详情请参见表1

函数返回值

int

出参

若函数执行成功则返回0,若函数执行失败则返回错误码。

表1 struct flexda_custom_info_t

属性类型

属性名称

属性描述

uint16_t

input_port_id

当前OVS卸载报文的源input端口。

dp_packet *

pkt

当前OVS卸载的报文。

rte_flow_action *

src_actions

当前OVS卸载的软件流表action。

使用实例

int flexda_custom_update_ctx(void *ctx, flexda_custom_info_t info)
{
    // 根据当前软件流表的action更新自定义上下文,例如存在POP_VLAN时将自定义上下文中的vlan_poped标志位置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;
}