本篇分析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_action_hash *hash_act = nla_data(attr);
u32 hash = 0;
/* OVS_HASH_ALG_L4 is the only possible hash algorithm. */
hash = skb_get_hash(skb);
hash = jhash_1word(hash, hash_act->hash_basis);
if (!hash)
hash = 0x1;
key->ovs_flow_hash = hash; //计算hash值
}该action仅对key的ovs_flow_hash成员变量进行了修改,从该变量的使用地方逆推,最终是queue_userspace_packet会使用,该函数是把报文发送给用户态进程,本次就看下queue_userspace_packet函数是如何使用到该成员变量的。
queue_userspace_packet函数
static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
const struct sw_flow_key *key,
const struct dp_upcall_info *upcall_info)
{
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
struct sk_buff *user_skb = NULL; /* to be

本文深入剖析OVS2.5.0中OVS_ACTION_ATTR_HASH行动,关注execute_hash处理函数。通过queue_userspace_packet函数,探讨数据包如何在用户空间进行调度。
最低0.47元/天 解锁文章
2297

被折叠的 条评论
为什么被折叠?



