mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
openvswitch: Extend packet attribute for egress tunnel info
OVS vswitch has extended IPFIX exporter to export tunnel headers to improve network visibility. To export this information userspace needs to know egress tunnel for given packet. By extending packet attributes datapath can export egress tunnel info for given packet. So that userspace can ask for egress tunnel info in userspace action. This information is used to build IPFIX data for given flow. Signed-off-by: Wenyu Zhang <wenyuz@vmware.com> Acked-by: Romain Lenglet <rlenglet@vmware.com> Acked-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
parent
9ba559d9ca
commit
8f0aad6f35
12 changed files with 275 additions and 31 deletions
|
@ -564,6 +564,7 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port)
|
|||
static int output_userspace(struct datapath *dp, struct sk_buff *skb,
|
||||
struct sw_flow_key *key, const struct nlattr *attr)
|
||||
{
|
||||
struct ovs_tunnel_info info;
|
||||
struct dp_upcall_info upcall;
|
||||
const struct nlattr *a;
|
||||
int rem;
|
||||
|
@ -572,6 +573,7 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
|
|||
upcall.key = key;
|
||||
upcall.userdata = NULL;
|
||||
upcall.portid = 0;
|
||||
upcall.egress_tun_info = NULL;
|
||||
|
||||
for (a = nla_data(attr), rem = nla_len(attr); rem > 0;
|
||||
a = nla_next(a, &rem)) {
|
||||
|
@ -583,7 +585,24 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
|
|||
case OVS_USERSPACE_ATTR_PID:
|
||||
upcall.portid = nla_get_u32(a);
|
||||
break;
|
||||
|
||||
case OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: {
|
||||
/* Get out tunnel info. */
|
||||
struct vport *vport;
|
||||
|
||||
vport = ovs_vport_rcu(dp, nla_get_u32(a));
|
||||
if (vport) {
|
||||
int err;
|
||||
|
||||
err = ovs_vport_get_egress_tun_info(vport, skb,
|
||||
&info);
|
||||
if (!err)
|
||||
upcall.egress_tun_info = &info;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} /* End of switch. */
|
||||
}
|
||||
|
||||
return ovs_dp_upcall(dp, skb, &upcall);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue