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,若函数执行失败则返回错误码。 |
使用实例
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;
}
父主题: Hook函数