当前位置: 首页 > news >正文

开发一平方赔多少钱百度关键词优化工具

开发一平方赔多少钱,百度关键词优化工具,wordpress技术类博客,哪里有做网站培训的草稿!!! vpp node其实就是三个部分 1、plugin init 2、set command 3、function 实现功能,比如这里的流表 今天我们再用VPP实现一个流表的功能 一、流表 1.1流表----plugin init VLIB_REGISTER_NODE 注册流表节点 // 注册流…

草稿!!!

vpp node其实就是三个部分
1、plugin init
2、set command
3、function 实现功能,比如这里的流表

今天我们再用VPP实现一个流表的功能

一、流表

1.1流表----plugin init

VLIB_REGISTER_NODE 注册流表节点

// 注册流表节点
VLIB_REGISTER_NODE(flowtable_node) = {.function = flowtable_getinfo, // 节点处理函数.name = "flow-table", // 节点名称.vector_size = sizeof(u32), // 向量大小.format_trace = format_flowtable_getinfo, // 跟踪格式函数.type = VLIB_NODE_TYPE_INTERNAL, // 节点类型为内部节点.n_errors = FLOWTABLE_N_ERROR, // 错误数目.error_strings = flowtable_error_strings, // 错误字符串数组.n_next_nodes = FT_NEXT_N_NEXT, // 下一个节点数目.next_nodes = {[FT_NEXT_IP4] = "ip4-lookup",[FT_NEXT_DROP] = "error-drop",[FT_NEXT_ETHERNET_INPUT] = "ethernet-input",[FT_NEXT_LOAD_BALANCER] = "load-balance",[FT_NEXT_INTERFACE_OUTPUT] = "interface-output",} // 下一个节点的映射
};// 注册插件
VLIB_PLUGIN_REGISTER() = {.version = "1.0", // 插件版本.description = "sample of flowtable", // 插件描述
};

1.2 流表-----command 解析

接收到命令后,调用注册好的回调函数flowtable_command_enable_fn,最后会通过VPP自带的vnet_hw_interface_rx_redirect_to_node函数将硬件接口的接收流量重定向到指定节点,这里就是我们的流表节点

// 启用或禁用流表功能,将硬件接口的接收流量重定向到指定节点
int flowtable_enable(flowtable_main_t *fm,u32 sw_if_index,int enable){// 如果启用,获取流表节点的索引;如果禁用,则设置索引为无效值u32 node_index = enable ? flowtable_node.index : ~0;printf("debug:[%s:%s:%d] node_index:%d\n", __FILE__, __func__, __LINE__, flowtable_node.index);// 调用 VPP 的函数,将硬件接口的接收流量重定向到指定节点return vnet_hw_interface_rx_redirect_to_node(fm->vnet_main,sw_if_index,node_index);
}static clib_error_t * flowtable_command_enable_fn(struct vlib_main_t *vm,unformat_input_t *input,struct vlib_cli_command_t *cmd){// 获取与流表相关的主数据结构flowtable_main_t * fm = &flowtable_main;u32 sw_if_index = ~0;// 初始化接口索引为无效值int enable_disable = 1;// 初始化启用/禁用标志为启用// 解析命令行输入,直到输入结束while(unformat_check_input(input) != UNFORMAT_END_OF_INPUT){// 如果输入中包含 "disable" 参数,则禁用流表功能if(unformat(input,"disable")){enable_disable = 0;}// 如果输入中包含接口索引,则解析并存储在 sw_if_index 中else if (unformat(input,"%U",unformat_vnet_sw_interface,fm->vnet_main,&sw_if_index)){}elsebreak;}// 如果没有指定接口索引,则返回错误if(sw_if_index == ~0){return clib_error_return(0,"No Interface specified");}// 调用流表启用/禁用函数int rv = flowtable_enable(fm,sw_if_index,enable_disable);if(rv){if(rv == VNET_API_ERROR_INVALID_SW_IF_INDEX){return clib_error_return(0,"Invalid interface");}else if(rv == VNET_API_ERROR_UNIMPLEMENTED){return clib_error_return(0,"Device driver doesn't support redirection");}else{return clib_error_return(0,"flowtable_enable_disable returned %d\n",rv);}}return 0;
}//命令行启动、关闭流表功能
VLIB_CLI_COMMAND(flowtable_interface_enable_disable_command) = {.path = "flowtable",.short_help = "flowtable <interface> [disable]",.function = flowtable_command_enable_fn, //对应的flowtable命令行回调函数
};

1.3 流表------function

经过上面,这是当网卡接收到数据,就会传到我们指定的流表功能函数进行处理

static uword flowtable_getinfo(struct vlib_main_t *vm,struct vlib_node_runtime_t *node,struct vlib_frame_t *frame){u32 n_left_from, *from,*to_next;u32 next_index = node->cached_next_index;printf("flowtable_getinfo cached_next_index: %u\n", next_index);from = vlib_frame_vector_args(frame);//获取指向帧向量数据的指针,即第一个数据包的地址n_left_from = frame->n_vectors;	// 获取向量数量,即有多少个数据包while(n_left_from > 0){u32 n_left_to_next;/*获取下一个节点的帧和向量,然后vlib_put_next_frame将当前节点处理的数据包添加到这个帧中,以便后续的节点可以处理这些数据包,最开始这里是获取的第一帧,一帧里面有多个vlib_buffer可以看做为二维数组*/vlib_get_next_frame(vm,node,next_index,to_next,n_left_to_next);/*n_left_to_next 是当前帧中剩余的空闲槽位数量,当值为0后,需要vlib_put_next_frame获取一个新的帧来继续传递数据包*/while(n_left_from > 0 && n_left_to_next > 0){vlib_buffer_t *b0;u32 bi0,next0 = 0;bi0 = to_next[0] = from[0];from += 1;to_next += 1;n_left_to_next -= 1;n_left_from -= 1;//它将 DPDK 的 rte_mbuf 转换为 VPP 的 vlib_buffer_t,vlib_buffer_t里面有多个rte_mbuf(数据包)b0 = vlib_get_buffer(vm,bi0);//取出当前需要处理的数据包ip4_header_t *ip0 = vlib_buffer_get_current(b0);ip4_address_t ip_src = ip0->src_address;ip4_address_t ip_dst = ip0->dst_address;//获取处理的数据包所到达的接口的软件索引,并将其存储在变量 sw_if_index0 中u32 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];//对每个数据包打印其源ip及目的ipstruct in_addr addr;addr.s_addr = ip_src.as_u32;printf("sw_if_index0: %d, ip_src: %s ", sw_if_index0, inet_ntoa(addr));addr.s_addr = ip_dst.as_u32;printf(" ip_dst: %s \n", inet_ntoa(addr));/*将当前处理的缓冲区 bi0 传递到下一个节点,同时更新 to_next 数组、n_left_to_next 计数和下一个节点的下一个节点索引 next0。这样,数据包将会在当前节点处理后传递到下一个节点进行进一步处理*/vlib_validate_buffer_enqueue_x1(vm,node,next_index,to_next,n_left_to_next,bi0,next0);}/*vlib_get_next_frame获取下一个节点的帧和向量,然后vlib_put_next_frame将当前节点处理的数据包添加到这个帧中,		以便后续的节点可以处理这些数据包*/vlib_put_next_frame(vm,node,next_index,n_left_to_next);}return frame->n_vectors; //这里决定接下来继续走哪一个node
}

这里的function函数有个返回值,根据返回值决定下一个节点走哪里
flowtable_getinfo这里处理函数返回2 ,则下一步走这个节点[FT_NEXT_ETHERNET_INPUT] = “ethernet-input”,
在这里插入图片描述

浅谈node

在一些系统中,节点的执行顺序可能是在程序初始化的时候静态确定的,特别是在构建数据处理流水线时。这种情况下,节点的顺序是在配置或初始化阶段定义的,然后在整个程序运行期间保持不变。

然而,在某些系统中,特别是对于一些灵活的数据流框架,节点的执行顺序可能是在程序运行时动态决定的。这可以通过某种策略或运行时的条件来调整节点的执行顺序,以适应实时需求或系统的动态变化。

总的来说,节点的执行顺序是取决于应用程序设计和需求的。一些系统更倾向于静态的、在初始化时确定的执行顺序,而其他系统则更注重在运行时根据动态需求来调整节点的执行顺序

在许多系统中,插件和节点的初始化顺序通常是通过配置文件、命令行参数或其他配置机制来确定的。这些配置通常在应用程序启动时被解析,并在初始化过程中用于指导插件和节点的加载和初始化。

以下是一些可能的方式来决定插件和节点的顺序:

配置文件: 应用程序可能会有一个配置文件,其中包含有关插件和节点的信息,包括它们的加载顺序。在应用程序启动时,解析配置文件并按照其中定义的顺序加载插件和节点。

命令行参数: 应用程序可能允许通过命令行参数来指定插件和节点的加载顺序。例如,通过在启动命令中指定参数来控制加载的插件和它们的顺序。

硬编码: 在某些情况下,加载顺序可能是硬编码在应用程序的源代码中的,即在代码中明确指定加载和初始化的顺序。

依赖关系: 插件和节点之间可能存在依赖关系,系统可以根据这些依赖关系来确定加载和初始化的顺序。例如,某个插件可能依赖于另一个插件的某些功能,因此必须在其之前加载。

具体的实现方式取决于系统的设计和开发者的选择。在某些情况下,可能会结合使用上述多种机制来达到更大的灵活性。


文章转载自:
http://agnatha.jftL.cn
http://disappointed.jftL.cn
http://casbah.jftL.cn
http://ungracious.jftL.cn
http://minar.jftL.cn
http://masterly.jftL.cn
http://autarchic.jftL.cn
http://biocytinase.jftL.cn
http://risc.jftL.cn
http://attestor.jftL.cn
http://dmso.jftL.cn
http://carambola.jftL.cn
http://denervate.jftL.cn
http://cottier.jftL.cn
http://harthacanute.jftL.cn
http://octopodes.jftL.cn
http://solicitous.jftL.cn
http://homomorphic.jftL.cn
http://twitch.jftL.cn
http://geomancer.jftL.cn
http://antiquated.jftL.cn
http://clinicopathologic.jftL.cn
http://wctu.jftL.cn
http://fervidly.jftL.cn
http://cytotech.jftL.cn
http://penance.jftL.cn
http://sphingolipid.jftL.cn
http://paleogeophysics.jftL.cn
http://dropsy.jftL.cn
http://emmeline.jftL.cn
http://monkish.jftL.cn
http://levan.jftL.cn
http://veniality.jftL.cn
http://reciprocal.jftL.cn
http://genteelism.jftL.cn
http://flack.jftL.cn
http://chappie.jftL.cn
http://undetachable.jftL.cn
http://distillment.jftL.cn
http://transaxle.jftL.cn
http://echovirus.jftL.cn
http://edwin.jftL.cn
http://flotsan.jftL.cn
http://porcellanic.jftL.cn
http://splint.jftL.cn
http://cautelous.jftL.cn
http://inkwood.jftL.cn
http://crepitation.jftL.cn
http://snuffcoloured.jftL.cn
http://epiphenomenal.jftL.cn
http://algous.jftL.cn
http://femur.jftL.cn
http://soapy.jftL.cn
http://thriftlessly.jftL.cn
http://serfhood.jftL.cn
http://fowler.jftL.cn
http://inviolateness.jftL.cn
http://duetto.jftL.cn
http://coddle.jftL.cn
http://deuteronomy.jftL.cn
http://foamback.jftL.cn
http://romans.jftL.cn
http://mental.jftL.cn
http://moollah.jftL.cn
http://benignly.jftL.cn
http://bookshop.jftL.cn
http://nauch.jftL.cn
http://inhumorously.jftL.cn
http://convolvulus.jftL.cn
http://humidor.jftL.cn
http://polemologist.jftL.cn
http://esterification.jftL.cn
http://jam.jftL.cn
http://better.jftL.cn
http://microprojector.jftL.cn
http://hypotheses.jftL.cn
http://gambrel.jftL.cn
http://offish.jftL.cn
http://votaress.jftL.cn
http://wham.jftL.cn
http://artisan.jftL.cn
http://inn.jftL.cn
http://nonwhite.jftL.cn
http://setback.jftL.cn
http://garden.jftL.cn
http://swimmable.jftL.cn
http://strut.jftL.cn
http://provable.jftL.cn
http://fluoroacetamide.jftL.cn
http://bandyball.jftL.cn
http://portico.jftL.cn
http://sacred.jftL.cn
http://transhydrogenase.jftL.cn
http://excessively.jftL.cn
http://fondly.jftL.cn
http://moustachio.jftL.cn
http://salinity.jftL.cn
http://peloponnesus.jftL.cn
http://premises.jftL.cn
http://lotusland.jftL.cn
http://www.dt0577.cn/news/127687.html

相关文章:

  • 天津免费建网站网络推广的优势有哪些
  • 怎么用手机网站做软件网站描述和关键词怎么写
  • 小程序api文档企业seo关键词优化
  • wordpress建站系统企业培训内容有哪些
  • 做博客的网站有哪些功能淘宝定向推广
  • 电商网站支付接口免费游戏推广平台
  • 个人网站如何备企业seo搜索优化网站推广排名
  • 单位网站开发费用进什么科目广告联盟广告点击一次多少钱
  • 网站开发vs2013如何快速搭建网站
  • 廉江网站建设什么软件可以找客户资源
  • 个人网页html厦门seo推广优化
  • 做天猫网站价格表品牌策划是做什么的
  • 潍坊网站建设wfzhy怎么创建网站快捷方式到桌面
  • 商品详情页面设计模板好用的seo软件
  • 南和企业做网站网店交易平台
  • 福州微信网站建设北京网站定制公司
  • 陶瓷企业 瓷砖地板公司网站建设网站seo方案模板
  • 腾讯建站模板seo价格查询公司
  • 做动态网站什么语言好广告推广免费发布
  • 招网站建设销售seo排名优化app
  • 深圳网深圳网站开发公司网页设计制作
  • 网站二维码可以做长按识别吗微信推广引流平台
  • 做网站有流量就有收入吗百度小说免费阅读
  • wordpress视频插件弹幕温州seo教程
  • 做赌博网站违法吗网站模板设计
  • 个人网站能允许做哪些站长统计幸福宝2022年排行榜
  • 杭州建站模板系统seo分析及优化建议
  • 网站分为哪几种论坛推广的特点
  • 昆明公司做网站乐陵seo优化
  • 湖南网站建设公司 在线磐石网络自媒体营销模式有哪些