From: Pravin Shelar Date: Thu, 8 Sep 2011 22:18:42 +0000 (-0700) Subject: Strip down vport interface : iflink X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff8d7a5e81625bbb13d33ca73888fc848b02db83;p=openvswitch Strip down vport interface : iflink Remove iflink from vport interface. iflink is not used anywhere in OVS. So there is not need to have iflink as vport attribute. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 7c9ec3b2..74990818 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -142,16 +142,12 @@ static int dp_fill_ifinfo(struct sk_buff *skb, { struct datapath *dp = port->dp; int ifindex = vport_get_ifindex(port); - int iflink = vport_get_iflink(port); struct ifinfomsg *hdr; struct nlmsghdr *nlh; if (ifindex < 0) return ifindex; - if (iflink < 0) - return iflink; - nlh = nlmsg_put(skb, 0, 0, event, sizeof(*hdr), flags); if (nlh == NULL) return -EMSGSIZE; @@ -177,9 +173,6 @@ static int dp_fill_ifinfo(struct sk_buff *skb, NLA_PUT(skb, IFLA_ADDRESS, ETH_ALEN, vport_get_addr(port)); - if (ifindex != iflink) - NLA_PUT_U32(skb, IFLA_LINK,iflink); - return nlmsg_end(skb, nlh); nla_put_failure: @@ -1613,7 +1606,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, { struct ovs_header *ovs_header; struct nlattr *nla; - int ifindex, iflink; + int ifindex; int mtu; int err; @@ -1648,10 +1641,6 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, if (ifindex > 0) NLA_PUT_U32(skb, OVS_VPORT_ATTR_IFINDEX, ifindex); - iflink = vport_get_iflink(vport); - if (iflink > 0) - NLA_PUT_U32(skb, OVS_VPORT_ATTR_IFLINK, iflink); - return genlmsg_end(skb, ovs_header); nla_put_failure: diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 8cb70834..f7776378 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -285,7 +285,6 @@ const struct vport_ops internal_vport_ops = { .is_running = netdev_is_running, .get_operstate = netdev_get_operstate, .get_ifindex = netdev_get_ifindex, - .get_iflink = netdev_get_iflink, .get_mtu = netdev_get_mtu, .send = internal_dev_recv, }; diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index d1e61bbd..dbc8db2c 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -257,12 +257,6 @@ int netdev_get_ifindex(const struct vport *vport) return netdev_vport->dev->ifindex; } -int netdev_get_iflink(const struct vport *vport) -{ - const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); - return netdev_vport->dev->iflink; -} - int netdev_get_mtu(const struct vport *vport) { const struct netdev_vport *netdev_vport = netdev_vport_priv(vport); @@ -444,7 +438,6 @@ const struct vport_ops netdev_vport_ops = { .is_running = netdev_is_running, .get_operstate = netdev_get_operstate, .get_ifindex = netdev_get_ifindex, - .get_iflink = netdev_get_iflink, .get_mtu = netdev_get_mtu, .send = netdev_send, }; diff --git a/datapath/vport-netdev.h b/datapath/vport-netdev.h index 88a5f90f..3f64767d 100644 --- a/datapath/vport-netdev.h +++ b/datapath/vport-netdev.h @@ -36,7 +36,6 @@ unsigned netdev_get_dev_flags(const struct vport *); int netdev_is_running(const struct vport *); unsigned char netdev_get_operstate(const struct vport *); int netdev_get_ifindex(const struct vport *); -int netdev_get_iflink(const struct vport *); int netdev_get_mtu(const struct vport *); #endif /* vport_netdev.h */ diff --git a/datapath/vport.c b/datapath/vport.c index 2b5a0b4e..bf6297e9 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -576,28 +576,6 @@ int vport_get_ifindex(const struct vport *vport) return 0; } -/** - * vport_get_iflink - retrieve device system link index - * - * @vport: vport from which to retrieve index - * - * Retrieves the system link index of the given device. The link is the index - * of the interface on which the packet will actually be sent. In most cases - * this is the same as the ifindex but may be different for tunnel devices. - * Returns a negative index on error. - * - * Must be called with RTNL lock or rcu_read_lock. - */ -int vport_get_iflink(const struct vport *vport) -{ - if (vport->ops->get_iflink) - return vport->ops->get_iflink(vport); - - /* If we don't have an iflink, use the ifindex. In most cases they - * are the same. */ - return vport_get_ifindex(vport); -} - /** * vport_get_mtu - retrieve device MTU * diff --git a/datapath/vport.h b/datapath/vport.h index 388ba1ce..0a6d831c 100644 --- a/datapath/vport.h +++ b/datapath/vport.h @@ -46,7 +46,6 @@ int vport_is_running(const struct vport *); unsigned char vport_get_operstate(const struct vport *); int vport_get_ifindex(const struct vport *); -int vport_get_iflink(const struct vport *); int vport_get_mtu(const struct vport *); @@ -172,9 +171,6 @@ struct vport_parms { * @get_operstate: Get the device's operating state. * @get_ifindex: Get the system interface index associated with the device. * May be null if the device does not have an ifindex. - * @get_iflink: Get the system interface index associated with the device that - * will be used to send packets (may be different than ifindex for tunnels). - * May be null if the device does not have an iflink. * @get_mtu: Get the device's MTU. May be %NULL if the device does not have an * MTU (as e.g. some tunnels do not). * @send: Send a packet on the device. Returns the length of the packet sent. @@ -209,7 +205,6 @@ struct vport_ops { unsigned char (*get_operstate)(const struct vport *); int (*get_ifindex)(const struct vport *); - int (*get_iflink)(const struct vport *); int (*get_mtu)(const struct vport *); diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 535aab3c..97a7c04d 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -225,8 +225,6 @@ enum ovs_vport_cmd { * @OVS_VPORT_ATTR_MTU: MTU for the vport. Omitted if the vport does not have * an MTU as, e.g., some tunnels do not. * @OVS_VPORT_ATTR_IFINDEX: ifindex of the underlying network device, if any. - * @OVS_VPORT_ATTR_IFLINK: ifindex of the device on which packets are sent (for - * tunnels), if any. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_VPORT_* commands. @@ -256,7 +254,6 @@ enum ovs_vport_attr { OVS_VPORT_ATTR_MTU, /* 32-bit maximum transmission unit */ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ OVS_VPORT_ATTR_IFINDEX, /* 32-bit ifindex of backing netdev */ - OVS_VPORT_ATTR_IFLINK, /* 32-bit ifindex on which packets are sent */ __OVS_VPORT_ATTR_MAX }; diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index adfef401..8d655f35 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -1241,7 +1241,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport, [OVS_VPORT_ATTR_MTU] = { .type = NL_A_U32, .optional = true }, [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true }, [OVS_VPORT_ATTR_IFINDEX] = { .type = NL_A_U32, .optional = true }, - [OVS_VPORT_ATTR_IFLINK] = { .type = NL_A_U32, .optional = true }, }; struct nlattr *a[ARRAY_SIZE(ovs_vport_policy)]; @@ -1286,9 +1285,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport, if (a[OVS_VPORT_ATTR_IFINDEX]) { vport->ifindex = nl_attr_get_u32(a[OVS_VPORT_ATTR_IFINDEX]); } - if (a[OVS_VPORT_ATTR_IFLINK]) { - vport->iflink = nl_attr_get_u32(a[OVS_VPORT_ATTR_IFLINK]); - } return 0; } @@ -1340,10 +1336,6 @@ dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport, if (vport->ifindex) { nl_msg_put_u32(buf, OVS_VPORT_ATTR_IFINDEX, vport->ifindex); } - - if (vport->iflink) { - nl_msg_put_u32(buf, OVS_VPORT_ATTR_IFLINK, vport->iflink); - } } /* Clears 'vport' to "empty" values. */ diff --git a/lib/dpif-linux.h b/lib/dpif-linux.h index 6526fb77..3a2c816a 100644 --- a/lib/dpif-linux.h +++ b/lib/dpif-linux.h @@ -40,7 +40,6 @@ struct dpif_linux_vport { const struct nlattr *options; /* OVS_VPORT_ATTR_OPTIONS. */ size_t options_len; int ifindex; /* OVS_VPORT_ATTR_IFINDEX. */ - int iflink; /* OVS_VPORT_ATTR_IFLINK. */ }; void dpif_linux_vport_init(struct dpif_linux_vport *);