From: Justin Pettit Date: Tue, 25 Aug 2009 21:12:01 +0000 (-0700) Subject: dpif: Address portability issues in dpif-netdev X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c71830aef987c86338d2d0223d4e6913aea25a4;p=openvswitch dpif: Address portability issues in dpif-netdev There were a number of Linux assumptions in dpif-netdev that were not necessary. This commit cleans those up to aid portability. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index e0b03d9f..9d163ea5 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -395,7 +395,7 @@ static int add_port(int dp_idx, struct odp_port __user *portp) for (port_no = 1; port_no < DP_MAX_PORTS; port_no++) if (!dp->ports[port_no]) goto got_port_no; - err = -EXFULL; + err = -EFBIG; goto out_unlock_dp; got_port_no: diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index d8f5ba73..4c25f139 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -23,15 +23,11 @@ #include #include #include -#include -#include -#include #include #include #include #include #include -#include #include #include "csum.h" @@ -424,7 +420,7 @@ dpif_netdev_port_add(struct dpif *dpif, const char *devname, uint16_t flags, return do_add_port(dp, devname, flags, port_no); } } - return EXFULL; + return EFBIG; } static int @@ -829,7 +825,7 @@ dpif_netdev_flow_put(struct dpif *dpif, struct odp_flow_put *put) if (hmap_count(&dp->flow_table) < MAX_FLOWS) { return add_flow(dpif, &put->flow); } else { - return EXFULL; + return EFBIG; } } else { return ENOENT; @@ -892,7 +888,7 @@ dpif_netdev_execute(struct dpif *dpif, uint16_t in_port, flow_t flow; int error; - if (packet->size < ETH_HLEN || packet->size > UINT16_MAX) { + if (packet->size < ETH_HEADER_LEN || packet->size > UINT16_MAX) { return EINVAL; } @@ -990,7 +986,7 @@ dp_netdev_flow_used(struct dp_netdev_flow *flow, const flow_t *key, time_timeval(&flow->used); flow->packet_count++; flow->byte_count += packet->size; - if (key->dl_type == htons(ETH_P_IP)) { + if (key->dl_type == htons(ETH_TYPE_IP)) { struct ip_header *nh = packet->l3; flow->ip_tos = nh->ip_tos; @@ -1163,7 +1159,7 @@ static void dp_netdev_set_tp_port(struct ofpbuf *packet, flow_t *key, const struct odp_action_tp_port *a) { - if (key->dl_type == htons(ETH_P_IP)) { + if (key->dl_type == htons(ETH_TYPE_IP)) { uint16_t *field; if (key->nw_proto == IPPROTO_TCP) { struct tcp_header *th = packet->l4; diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index ea0641ef..25df8d48 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -547,7 +547,7 @@ bridge_reconfigure(void) /* Add to datapath. */ error = dpif_port_add(br->dpif, if_name, internal ? ODP_PORT_INTERNAL : 0, NULL); - if (error == EXFULL) { + if (error == EFBIG) { VLOG_ERR("ran out of valid port numbers on %s", dpif_name(br->dpif)); break;