flexda_custom_construct_action
接口功能
用户构建下发硬件流表action。
接口格式
int flexda_custom_construct_action ( void *ctx, const struct flexda_custom_info_t *info, struct rte_flow_action *hw_action)
参数说明
参数名 |
参数类型 |
入参/出参 |
说明 |
|---|---|---|---|
ctx |
void * |
入参 |
自定义上下文的地址。提取的头信息也保存其中。 |
info |
struct flexda_custom_info_t * |
入参 |
dpak-ovs提供flexda-ovs读取使用的信息。详情请参见表1。 |
hw_action |
struct rte_flow_action * |
入参 |
该接口包含硬件流表action的地址,其中已保存拼接跳表后的软件流表action。 |
函数返回值 |
int |
出参 |
若函数执行成功则返回0,若函数执行失败则返回错误码。 |
使用实例
int flexda_custom_construct_action(void *ctx, flexda_custom_info_t info, struct rte_flow_action *hw_action)
{
struct custom_packet_ctx *custom_ctx = (struct custom_packet_ctx *)ctx;
// 根据上下文条件控制组action流程,需要保证下发Hydra里table支持的action
#define HWOFF_FLOW_ACT_DEF_INNER_RSS 364
if (custom_ctx->vlan_poped == 1) {
// 下发rss action,需要先调用内存api申请内存,写入key数据后调用插入key api,之后内存管理权限交给框架不需要释放
uint32_t *rss = flexda_calloc(1, sizeof(uint32_t));
// 需注意action下发data要进行字节大小端转换
*rss = htonl(1);
// Hydra自定义action类型使用匹配的插入key api,提供与Hydra匹配的长度和类型枚举值
flexda_insert_hydra_action(hw_action, -1, rss, sizeof(uint32_t), HWOFF_FLOW_ACT_DEF_INNER_RSS);
}
return 0;
}
父主题: Hook函数