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

flexda_custom_construct_attr

接口功能

构建下发硬件流表attr。

接口格式

int flexda_custom_construct_attr(void *ctx, const struct flexda_custom_info_t *info, struct rte_flow_attr *attr)

参数说明

参数名

参数类型

入参/出参

说明

ctx

void *

入参

自定义上下文的地址。提取的头信息也保存其中。

info

struct flexda_custom_info_t *

入参

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

hw_action

struct rte_flow_action *

入参

该接口组装硬件流表action的attr,目前包含table_id以及flexda-dpdk是否开启的标记。

函数返回值

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_construct_attr(void *ctx, flexda_custom_info_t info, struct rte_flow_attr *attr)
{
    struct custom_packet_ctx *custom_ctx = (struct custom_packet_ctx *)ctx;
    // 根据自定义上下文,将Hydra table的枚举值赋给attr中的group来指定下发的table
    if (custom_ctx->vlan_poped == 1) {
        attr->group = HYDRA_TABLE_MYMAINPIPE_VLAN_EXACT;
    }
    return 0;
}