自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

one_clouder的专栏

漫步云中,关注云网络领域

  • 博客(28)
  • 收藏
  • 关注

原创 【Linux4.1.12源码分析】二层报文发送之GSO条件判断

4.1.12内核中,GSO报文的判断和分段的入口函数是validate_xmit_skb,其中使用netif_needs_gso用来判断软件是否要进行GSO分段,skb_gso_segment实现报文的GSO分段,本篇重点讲述GSO分段的判断条件,即netif_needs_gso相关函数。1、netif_needs_gso函数static inline bool netif_needs_g

2016-09-29 23:45:30 2936

原创 【Linux4.1.12源码分析】二层报文发送之qdisc实现分析

二层发送中,实现qdisc的主要函数是__dev_xmit_skb和net_tx_action,本篇将分析qdisc实现的原理,但是不涉及qdisc内部的算法,仅对框架进行分析。1、__dev_xmit_skb函数static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, struct net_de

2016-09-27 22:39:51 4530

原创 【Linux4.1.12源码分析】二层报文发送之dev_queue_xmit

报文到此阶段,已经完成了MAC头封装,在调用驱动发送报文前还有一些工作要做:1)流量控制; 2)报文GSO分段;3)check sum计算;1、dev_queue_xmit函数static inline int dev_queue_xmit(struct sk_buff *skb){ return dev_queue_xmit_sk(skb->sk, skb);}2、dev_queu

2016-09-27 22:07:13 3353

原创 【Linux4.1.12源码分析】IP层报文发送之ip_output

上一篇提到ip_local_out函数最终会调用ip_output完成报文发送,本篇分析ip_output的处理过程。1、ip_output函数int ip_output(struct sock *sk, struct sk_buff *skb){ struct net_device *dev = skb_dst(skb)->dev; IP_UPD_PO_STATS(d

2016-09-26 22:01:46 3701

原创 【Linux4.1.12源码分析】IP层报文发送之ip_local_out

IP层本地报文发送有两个函数ip_local_out和ip_local_out_sk,实际实现两者是等同的,因为本地发送的报文,skb必然关联着一个sock对象。1、ip_local_out函数static inline int ip_local_out(struct sk_buff *skb){ return ip_local_out_sk(skb->sk, skb); //本地报文

2016-09-25 23:23:20 3414 1

原创 【Linux4.1.12源码分析】vxlan报文发送之iptunnel_xmit

iptunnel_xmit函数是发送vxlan报文时,封装UDP报文头之后被调用的,主要作用是封装IP头,并调用三层发包函数,完成报文的发送,该函数相对比较简单。1、iptunnel_xmit函数int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, __be32 src, __be32

2016-09-25 23:07:25 2165

原创 【Linux4.1.12源码分析】vxlan报文发送之udp_tunnel_xmit_skb

udp_tunnel_xmit_skb函数是OVS2.5发送UDP报文的内核入口,在调用该函数之前,headroom空间需要准备完成,且vxlan头已经创建,skb结构体的data指向vxlan头的首地址。1、udp_tunnel_xmit_skb函数int udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_

2016-09-25 18:28:47 1949

原创 【OVS2.5.0源码分析】vxlan发包流程分析

发包处理函数最终会调用到ovs_vport_send函数,该函数最终会调用vport_ops的send函数。1、ovs_vport_send函数void ovs_vport_send(struct vport *vport, struct sk_buff *skb){ int mtu = vport->dev->mtu; if (unlikely(packet_length(skb

2016-09-21 22:27:27 6490 2

原创 【OVS2.5.0源码分析】sFlow实现分析(3)

本篇分析,sflow的消息处理,处理入口函数是在process_upcall函数。1、process_upcall函数 case SFLOW_UPCALL: if (upcall->sflow) { union user_action_cookie cookie; const struct nlattr *actions

2016-09-18 18:36:25 1580

原创 【OVS2.5.0源码分析】sFlow实现分析(2)

本篇分析,sFlow流表生成过程,sFlow流表是在xlate_actions函数中生成,然后通过netlink下发给datapath的。1、xlate_actions函数 /* Sampling is done only for packets really received by the bridge. */ unsigned int user_cooki

2016-09-13 06:49:35 1289

原创 【OVS2.5.0源码分析】datapath之netlink

ovs datapath是通过netlink与用户态进行通信的,实现dp、端口、流表、packet的操作。 netlink的注册是在datapath模块的初始化函数中实现的。1、dp_init函数static int __init dp_init(void){ int err; BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEO

2016-09-13 06:25:09 1080

原创 【OVS2.5.0源码分析】sFlow实现分析(1)

sFlow实现可以分成4个部分:1)配置;2)流表生成(生成datapath的流表);3)datapath中的处理(已经分析);4)sFlow处理过程。本篇分析sFlow的配置过程。1、bridge_configure_sflow函数/* Set sFlow configuration on 'br'. */static voidbridge_configure_sflow(struc

2016-09-09 22:33:49 1906

原创 【OVS2.5.0源码分析】upcall处理线程分析(4)

前两篇分析了接收netlink消息和解析netlink消息生成upcall对象,本篇分析upcall的处理。 处理函数为process_upcall。1、process_upcall函数static intprocess_upcall(struct udpif *udpif, struct upcall *upcall, struct ofpbuf *odp

2016-09-09 21:46:20 1423

原创 【OVS2.5.0源码分析】upcall处理线程分析(3)

第一篇介绍了netlink消息的接收,接收到的消息是最原始的消息格式,本篇介绍如何把原始的消息,转化为upcall对象。1、parse_odp_packet函数static intparse_odp_packet(const struct dpif_netlink *dpif, struct ofpbuf *buf, struct dpif_upcall

2016-09-08 22:22:33 1192

原创 【OVS2.5.0源码分析】upcall处理线程分析(2)

上一篇介绍了netlink报文的接收过程,其中用到了sock对象、event对象等、channel对象,本篇分析这些对象是何时构建的。 构建入口是dpif_netlink_port_add函数。1、dpif_netlink_port_add函数static intdpif_netlink_port_add(struct dpif *dpif_, struct netdev *netdev

2016-09-08 21:48:42 1093

原创 【OVS2.5.0源码分析】dpif向dp发送netlink消息分析

OVS用户态进程与内核模块是通过netlink进行通信的,本篇分析下用户态向内核态发送netlink消息的方法,发送消息入口有两个函数nl_transact和nl_transact_multiple,本篇以nl_transact_multiple为例进行分析。1、nl_transact_multiple函数voidnl_transact_multiple(int protocol,

2016-09-07 22:59:46 1618

原创 【OVS2.5.0源码分析】nlattr数据结构分析

从nlattr类型定义来看,是非常简单,但是OVS使用该数据结构来定义action,nlattr自身是不存储数据,而使用来定义数据格式的,OVS也会使用skb来存储真实数据。nlattr数据结构定义struct nlattr { uint16_t nla_len; //数据长度 uint16_t nla_type; //数据类型};使用nlattr构造的数据

2016-09-06 22:33:01 4269

原创 【OVS2.5.0源码分析】datapath之action分析(8)

本篇分析OVS_ACTION_ATTR_SAMPLE action的处理函数sample。1、sample函数static int sample(struct datapath *dp, struct sk_buff *skb, struct sw_flow_key *key, const struct nlattr *attr, const struct nlattr *

2016-09-06 22:01:40 1003

原创 【OVS2.5.0源码分析】datapath之action分析(7)

本篇分析OVS_ACTION_ATTR_SET_MASKED 和 OVS_ACTION_ATTR_SET_TO_MASKED action,处理函数为execute_masked_set_action函数。1、execute_masked_set_action函数static int execute_masked_set_action(struct sk_buff *skb,

2016-09-05 23:51:25 897

原创 【OVS2.5.0源码分析】datapath之action分析(6)

今天分析OVS_ACTION_ATTR_RECIRC action的处理函数execute_recirc。1、execute_recirc函数static int execute_recirc(struct datapath *dp, struct sk_buff *skb, struct sw_flow_key *key, const struct nlattr *a

2016-09-05 22:45:14 1609 1

原创 【OVS2.5.0源码分析】datapath之action分析(5)

今天分析OVS_ACTION_ATTR_SET action的处理函数execute_set_action函数。1、execute_set_action函数static int execute_set_action(struct sk_buff *skb, struct sw_flow_key *flow_key, const struct nlattr

2016-09-05 21:52:15 931

原创 【OVS2.5.0源码分析】datapath之action分析(4)

本篇分析OVS_ACTION_ATTR_POP_VLAN action的处理函数pop_vlan。1、pop_vlan函数static int pop_vlan(struct sk_buff *skb, struct sw_flow_key *key){ int err; err = skb_vlan_pop(skb); if (skb_vlan_tag_present(skb)

2016-09-04 09:20:49 978

原创 【OVS2.5.0源码分析】datapath之action分析(3)

本篇分析OVS_ACTION_ATTR_PUSH_VLAN action,该action的处理函数为push_vlan。1、push_vlan函数static int push_vlan(struct sk_buff *skb, struct sw_flow_key *key, const struct ovs_action_push_vlan *vlan){ if (s

2016-09-04 08:30:24 1218

原创 【OVS2.5.0源码分析】datapath之action分析(2)

本篇分析OVS_ACTION_ATTR_HASH action,该action的处理函数为execute_hash函数1、execute_hash函数static void execute_hash(struct sk_buff *skb, struct sw_flow_key *key, const struct nlattr *attr){ struct ovs_actio

2016-09-04 00:33:34 1127

原创 【OVS2.5.0源码分析】upcall处理线程分析(1)

upcall线程处理由datapath通过netlink机制上送的报文,其入口函数为udpif_upcall_handler,这一篇我们先分析该线程是如何收取upcall报文的。1、udpif_upcall_handler函数/* The upcall handler thread tries to read a batch of UPCALL_MAX_BATCH * upcalls f

2016-09-02 22:52:43 2039

原创 【OVS2.5.0源码分析】datapath之action分析(1)

OVS dp支持的action都在do_execute_actions函数中定义,支持的action包括:OVS_ACTION_ATTR_OUTPUT、OVS_ACTION_ATTR_USERSPACE、OVS_ACTION_ATTR_HASH、OVS_ACTION_ATTR_PUSH_MPLS、OVS_ACTION_ATTR_POP_MPLS、OVS_ACTION_ATTR_PUSH_VLAN、

2016-09-02 22:13:15 1810 1

原创 【OVS2.5.0源码分析】datapath之流表创建过程

上一篇分析了流表查找过程,支撑流表查询的相关信息是什么时候建立,是怎么建立的将在本篇分析。 datapath流表更新的入口函数都定义在dp_flow_genl_ops中,流表创建的入口函数是ovs_flow_cmd_new函数,通过该函数,我们可以一窥流表相关信息的建立。1、ovs_flow_cmd_new函数static int ovs_flow_cmd_new(struct sk_bu

2016-09-02 00:20:09 2080

原创 【OVS2.5.0源码分析】datapath之流表查询

流表查询是datapath报文处理过程中,最为关键的一个步骤,一个skb报文进入如何能够快速地进行匹配流表? 本篇分析ovs是如何查询流表的。1、ovs_flow_tbl_lookup_stats函数struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl, const struct sw_flow_ke

2016-09-01 23:57:22 1510

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除