From 33b14e70e2c1c6dd6bf52ae4ec3099bc4456270e Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Wed, 5 Oct 2011 19:06:29 -0700 Subject: [PATCH 1/1] datapath: Strip down vport interface - ifIndex. Following patch removes ifIndex attribute of vport which is not used in userspace. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross Bug #7114 --- datapath/datapath.c | 5 ----- include/openvswitch/datapath-protocol.h | 6 ------ lib/dpif-linux.c | 8 -------- lib/dpif-linux.h | 1 - 4 files changed, 20 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 15c1e33b2..a925f6f2b 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1551,7 +1551,6 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, { struct ovs_header *ovs_header; struct nlattr *nla; - int ifindex; int err; ovs_header = genlmsg_put(skb, pid, seq, &dp_vport_genl_family, @@ -1578,10 +1577,6 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, if (err == -EMSGSIZE) goto error; - ifindex = vport_get_ifindex(vport); - if (ifindex > 0) - NLA_PUT_U32(skb, OVS_VPORT_ATTR_IFINDEX, ifindex); - return genlmsg_end(skb, ovs_header); nla_put_failure: diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 3db960a9c..6c8941110 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -230,15 +230,10 @@ enum ovs_vport_cmd { * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for * packets sent or received through the vport. * @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport. - * @OVS_VPORT_ATTR_IFINDEX: ifindex of the underlying network device, if any. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_VPORT_* commands. * - * All attributes applicable to a given port are present in notifications. - * This means that, for example, a vport that has no corresponding network - * device would omit %OVS_VPORT_ATTR_IFINDEX. - * * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is * optional; if not specified a free port number is automatically selected. @@ -259,7 +254,6 @@ enum ovs_vport_attr { OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_ADDRESS, /* hardware address */ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ - OVS_VPORT_ATTR_IFINDEX, /* 32-bit ifindex of backing netdev */ __OVS_VPORT_ATTR_MAX }; diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 4ddd46476..898150067 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -1299,7 +1299,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport, .max_len = ETH_ADDR_LEN, .optional = true }, [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true }, - [OVS_VPORT_ATTR_IFINDEX] = { .type = NL_A_U32, .optional = true }, }; struct nlattr *a[ARRAY_SIZE(ovs_vport_policy)]; @@ -1339,9 +1338,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport, vport->options = nl_attr_get(a[OVS_VPORT_ATTR_OPTIONS]); vport->options_len = nl_attr_get_size(a[OVS_VPORT_ATTR_OPTIONS]); } - if (a[OVS_VPORT_ATTR_IFINDEX]) { - vport->ifindex = nl_attr_get_u32(a[OVS_VPORT_ATTR_IFINDEX]); - } return 0; } @@ -1387,10 +1383,6 @@ dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport, nl_msg_put_nested(buf, OVS_VPORT_ATTR_OPTIONS, vport->options, vport->options_len); } - - if (vport->ifindex) { - nl_msg_put_u32(buf, OVS_VPORT_ATTR_IFINDEX, vport->ifindex); - } } /* Clears 'vport' to "empty" values. */ diff --git a/lib/dpif-linux.h b/lib/dpif-linux.h index 41ede747e..f1a4faad3 100644 --- a/lib/dpif-linux.h +++ b/lib/dpif-linux.h @@ -39,7 +39,6 @@ struct dpif_linux_vport { const uint8_t *address; /* OVS_VPORT_ATTR_ADDRESS. */ const struct nlattr *options; /* OVS_VPORT_ATTR_OPTIONS. */ size_t options_len; - int ifindex; /* OVS_VPORT_ATTR_IFINDEX. */ }; void dpif_linux_vport_init(struct dpif_linux_vport *); -- 2.45.2