char *name;
int open_cnt;
bool destroyed;
+ int max_mtu; /* Maximum MTU of any port added so far. */
struct dp_netdev_queue queues[N_QUEUES];
struct hmap flow_table; /* Flow table. */
/* All netdev-based datapaths. */
static struct shash dp_netdevs = SHASH_INITIALIZER(&dp_netdevs);
-/* Maximum port MTU seen so far. */
-static int max_mtu = ETH_PAYLOAD_MAX;
-
static int get_port_by_number(struct dp_netdev *, odp_port_t port_no,
struct dp_netdev_port **portp);
static int get_port_by_name(struct dp_netdev *, const char *devname,
dp->class = class;
dp->name = xstrdup(name);
dp->open_cnt = 0;
+ dp->max_mtu = ETH_PAYLOAD_MAX;
for (i = 0; i < N_QUEUES; i++) {
dp->queues[i].head = dp->queues[i].tail = 0;
}
port->type = xstrdup(type);
error = netdev_get_mtu(netdev, &mtu);
- if (!error && mtu > max_mtu) {
- max_mtu = mtu;
+ if (!error && mtu > dp->max_mtu) {
+ dp->max_mtu = mtu;
}
list_push_back(&dp->port_list, &port->node);
dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
struct flow *flow)
{
+ odp_port_t in_port;
+
if (odp_flow_key_to_flow(key, key_len, flow) != ODP_FIT_PERFECT) {
/* This should not happen: it indicates that odp_flow_key_from_flow()
* and odp_flow_key_to_flow() disagree on the acceptable form of a
return EINVAL;
}
- if (!is_valid_port_number(flow->in_port.odp_port)) {
+ in_port = flow->in_port.odp_port;
+ if (!is_valid_port_number(in_port) && in_port != ODPP_NONE) {
return EINVAL;
}
struct dp_netdev_port *port;
struct ofpbuf packet;
- ofpbuf_init(&packet, DP_NETDEV_HEADROOM + VLAN_ETH_HEADER_LEN + max_mtu);
+ ofpbuf_init(&packet,
+ DP_NETDEV_HEADROOM + VLAN_ETH_HEADER_LEN + dp->max_mtu);
LIST_FOR_EACH (port, node, &dp->port_list) {
int error;