{
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;
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:
{
struct ovs_header *ovs_header;
struct nlattr *nla;
- int ifindex, iflink;
+ int ifindex;
int mtu;
int err;
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:
.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,
};
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);
.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,
};
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 */
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
*
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 *);
* @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.
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 *);
* @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.
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
};
[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)];
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;
}
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. */
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 *);