diff options
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif-upcall.c | 23 | ||||
-rw-r--r-- | ofproto/ofproto-dpif-xlate.c | 33 | ||||
-rw-r--r-- | ofproto/ofproto-dpif.c | 278 | ||||
-rw-r--r-- | ofproto/ofproto-dpif.h | 7 | ||||
-rw-r--r-- | ofproto/ofproto-provider.h | 27 | ||||
-rw-r--r-- | ofproto/ofproto.c | 109 | ||||
-rw-r--r-- | ofproto/ofproto.h | 20 |
7 files changed, 4 insertions, 493 deletions
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 2612b7d72..f62f46b8e 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -221,9 +221,6 @@ struct upcall { struct dpif_ipfix *ipfix; /* IPFIX pointer or NULL. */ struct dpif_sflow *sflow; /* SFlow pointer or NULL. */ - bool vsp_adjusted; /* 'packet' and 'flow' were adjusted for - VLAN splinters if true. */ - struct udpif_key *ukey; /* Revalidator flow cache. */ bool ukey_persists; /* Set true to keep 'ukey' beyond the lifetime of this upcall. */ @@ -791,10 +788,6 @@ recv_upcalls(struct handler *handler) upcall->out_tun_key = dupcall->out_tun_key; upcall->actions = dupcall->actions; - if (vsp_adjust_flow(upcall->ofproto, flow, &dupcall->packet)) { - upcall->vsp_adjusted = true; - } - pkt_metadata_from_flow(&dupcall->packet.md, flow); flow_extract(&dupcall->packet, flow); @@ -1037,7 +1030,6 @@ upcall_receive(struct upcall *upcall, const struct dpif_backer *backer, ofpbuf_init(&upcall->put_actions, 0); upcall->xout_initialized = false; - upcall->vsp_adjusted = false; upcall->ukey_persists = false; upcall->ukey = NULL; @@ -1312,21 +1304,6 @@ handle_upcalls(struct udpif *udpif, struct upcall *upcalls, const struct dp_packet *packet = upcall->packet; struct ukey_op *op; - if (upcall->vsp_adjusted) { - /* This packet was received on a VLAN splinter port. We added a - * VLAN to the packet to make the packet resemble the flow, but the - * actions were composed assuming that the packet contained no - * VLAN. So, we must remove the VLAN header from the packet before - * trying to execute the actions. */ - if (upcall->odp_actions.size) { - eth_pop_vlan(CONST_CAST(struct dp_packet *, upcall->packet)); - } - - /* Remove the flow vlan tags inserted by vlan splinter logic - * to ensure megaflow masks generated match the data path flow. */ - CONST_CAST(struct flow *, upcall->flow)->vlan_tci = 0; - } - /* Do not install a flow into the datapath if: * * - The datapath already has too many flows. diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index ef770f286..cdf5a830c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3125,17 +3125,6 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, } else { odp_port = xport->odp_port; out_port = odp_port; - if (ofproto_has_vlan_splinters(ctx->xbridge->ofproto)) { - ofp_port_t vlandev_port; - - wc->masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI); - vlandev_port = vsp_realdev_to_vlandev(ctx->xbridge->ofproto, - ofp_port, flow->vlan_tci); - if (vlandev_port != ofp_port) { - out_port = ofp_port_to_odp_port(ctx->xbridge, vlandev_port); - flow->vlan_tci = htons(0); - } - } } if (out_port != ODPP_NONE) { @@ -5120,26 +5109,12 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) }; /* 'base_flow' reflects the packet as it came in, but we need it to reflect - * the packet as the datapath will treat it for output actions: - * - * - Our datapath doesn't retain tunneling information without us - * re-setting it, so clear the tunnel data. - * - * - For VLAN splinters, a higher layer may pretend that the packet - * came in on 'flow->in_port.ofp_port' with 'flow->vlan_tci' - * attached, because that's how we want to treat it from an OpenFlow - * perspective. But from the datapath's perspective it actually came - * in on a VLAN device without any VLAN attached. So here we put the - * datapath's view of the VLAN information in 'base_flow' to ensure - * correct treatment. + * the packet as the datapath will treat it for output actions. Our + * datapath doesn't retain tunneling information without us re-setting + * it, so clear the tunnel data. */ + memset(&ctx.base_flow.tunnel, 0, sizeof ctx.base_flow.tunnel); - if (flow->in_port.ofp_port - != vsp_realdev_to_vlandev(xbridge->ofproto, - flow->in_port.ofp_port, - flow->vlan_tci)) { - ctx.base_flow.vlan_tci = 0; - } ofpbuf_reserve(ctx.odp_actions, NL_A_U32_SIZE); if (xin->wc) { diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 285e377b9..a1e0407a6 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -189,34 +189,8 @@ struct ofport_dpif { /* Queue to DSCP mapping. */ struct ofproto_port_queue *qdscp; size_t n_qdscp; - - /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device - * drivers in old versions of Linux that do not properly support VLANs when - * VLAN devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - ofp_port_t realdev_ofp_port; - int vlandev_vid; }; -/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device drivers - * in old versions of Linux that do not properly support VLANs when VLAN - * devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ -struct vlan_splinter { - struct hmap_node realdev_vid_node; - struct hmap_node vlandev_node; - ofp_port_t realdev_ofp_port; - ofp_port_t vlandev_ofp_port; - int vid; -}; - -static void vsp_remove(struct ofport_dpif *); -static void vsp_add(struct ofport_dpif *, ofp_port_t realdev_ofp_port, int vid); - static odp_port_t ofp_port_to_odp_port(const struct ofproto_dpif *, ofp_port_t); @@ -330,11 +304,6 @@ struct ofproto_dpif { struct rstp *rstp; long long int rstp_last_tick; - /* VLAN splinters. */ - struct ovs_mutex vsp_mutex; - struct hmap realdev_vid_map OVS_GUARDED; /* (realdev,vid) -> vlandev. */ - struct hmap vlandev_map OVS_GUARDED; /* vlandev -> (realdev,vid). */ - /* Ports. */ struct sset ports; /* Set of standard port names. */ struct sset ghost_ports; /* Ports with no datapath port. */ @@ -1329,13 +1298,9 @@ construct(struct ofproto *ofproto_) ofproto->has_bonded_bundles = false; ofproto->lacp_enabled = false; ovs_mutex_init_adaptive(&ofproto->stats_mutex); - ovs_mutex_init(&ofproto->vsp_mutex); guarded_list_init(&ofproto->ams); - hmap_init(&ofproto->vlandev_map); - hmap_init(&ofproto->realdev_vid_map); - sset_init(&ofproto->ports); sset_init(&ofproto->ghost_ports); sset_init(&ofproto->port_poll_set); @@ -1487,15 +1452,11 @@ destruct(struct ofproto *ofproto_) mac_learning_unref(ofproto->ml); mcast_snooping_unref(ofproto->ms); - hmap_destroy(&ofproto->vlandev_map); - hmap_destroy(&ofproto->realdev_vid_map); - sset_destroy(&ofproto->ports); sset_destroy(&ofproto->ghost_ports); sset_destroy(&ofproto->port_poll_set); ovs_mutex_destroy(&ofproto->stats_mutex); - ovs_mutex_destroy(&ofproto->vsp_mutex); seq_destroy(ofproto->ams_seq); @@ -1737,8 +1698,6 @@ port_construct(struct ofport *port_) port->peer = NULL; port->qdscp = NULL; port->n_qdscp = 0; - port->realdev_ofp_port = 0; - port->vlandev_vid = 0; port->carrier_seq = netdev_get_carrier_resets(netdev); port->is_layer3 = netdev_vport_is_layer3(netdev); @@ -4902,9 +4861,6 @@ parse_flow_and_packet(int argc, const char *argv[], error = "Invalid datapath flow"; goto exit; } - - vsp_adjust_flow(*ofprotop, flow, NULL); - } else { char *err = parse_ofp_exact_flow(flow, NULL, argv[argc - 1], NULL); @@ -5414,239 +5370,6 @@ table_is_internal(uint8_t table_id) return table_id == TBL_INTERNAL; } -/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device drivers - * in old versions of Linux that do not properly support VLANs when VLAN - * devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - -static int -set_realdev(struct ofport *ofport_, ofp_port_t realdev_ofp_port, int vid) -{ - struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport_->ofproto); - struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); - - if (realdev_ofp_port == ofport->realdev_ofp_port - && vid == ofport->vlandev_vid) { - return 0; - } - - ofproto->backer->need_revalidate = REV_RECONFIGURE; - - if (ofport->realdev_ofp_port) { - vsp_remove(ofport); - } - if (realdev_ofp_port && ofport->bundle) { - /* vlandevs are enslaved to their realdevs, so they are not allowed to - * themselves be part of a bundle. */ - bundle_set(ofport_->ofproto, ofport->bundle, NULL); - } - - ofport->realdev_ofp_port = realdev_ofp_port; - ofport->vlandev_vid = vid; - - if (realdev_ofp_port) { - vsp_add(ofport, realdev_ofp_port, vid); - } - - return 0; -} - -static uint32_t -hash_realdev_vid(ofp_port_t realdev_ofp_port, int vid) -{ - return hash_2words(ofp_to_u16(realdev_ofp_port), vid); -} - -bool -ofproto_has_vlan_splinters(const struct ofproto_dpif *ofproto) - OVS_EXCLUDED(ofproto->vsp_mutex) -{ - /* hmap_is_empty is thread safe. */ - return !hmap_is_empty(&ofproto->realdev_vid_map); -} - - -static ofp_port_t -vsp_realdev_to_vlandev__(const struct ofproto_dpif *ofproto, - ofp_port_t realdev_ofp_port, ovs_be16 vlan_tci) - OVS_REQUIRES(ofproto->vsp_mutex) -{ - if (!hmap_is_empty(&ofproto->realdev_vid_map)) { - int vid = vlan_tci_to_vid(vlan_tci); - const struct vlan_splinter *vsp; - - HMAP_FOR_EACH_WITH_HASH (vsp, realdev_vid_node, - hash_realdev_vid(realdev_ofp_port, vid), - &ofproto->realdev_vid_map) { - if (vsp->realdev_ofp_port == realdev_ofp_port - && vsp->vid == vid) { - return vsp->vlandev_ofp_port; - } - } - } - return realdev_ofp_port; -} - -/* Returns the OFP port number of the Linux VLAN device that corresponds to - * 'vlan_tci' on the network device with port number 'realdev_ofp_port' in - * 'struct ofport_dpif'. For example, given 'realdev_ofp_port' of eth0 and - * 'vlan_tci' 9, it would return the port number of eth0.9. - * - * Unless VLAN splinters are enabled for port 'realdev_ofp_port', this - * function just returns its 'realdev_ofp_port' argument. */ -ofp_port_t -vsp_realdev_to_vlandev(const struct ofproto_dpif *ofproto, - ofp_port_t realdev_ofp_port, ovs_be16 vlan_tci) - OVS_EXCLUDED(ofproto->vsp_mutex) -{ - ofp_port_t ret; - - /* hmap_is_empty is thread safe, see if we can return immediately. */ - if (hmap_is_empty(&ofproto->realdev_vid_map)) { - return realdev_ofp_port; - } - ovs_mutex_lock(&ofproto->vsp_mutex); - ret = vsp_realdev_to_vlandev__(ofproto, realdev_ofp_port, vlan_tci); - ovs_mutex_unlock(&ofproto->vsp_mutex); - return ret; -} - -static struct vlan_splinter * -vlandev_find(const struct ofproto_dpif *ofproto, ofp_port_t vlandev_ofp_port) -{ - struct vlan_splinter *vsp; - - HMAP_FOR_EACH_WITH_HASH (vsp, vlandev_node, - hash_ofp_port(vlandev_ofp_port), - &ofproto->vlandev_map) { - if (vsp->vlandev_ofp_port == vlandev_ofp_port) { - return vsp; - } - } - - return NULL; -} - -/* Returns the OpenFlow port number of the "real" device underlying the Linux - * VLAN device with OpenFlow port number 'vlandev_ofp_port' and stores the - * VLAN VID of the Linux VLAN device in '*vid'. For example, given - * 'vlandev_ofp_port' of eth0.9, it would return the OpenFlow port number of - * eth0 and store 9 in '*vid'. - * - * Returns 0 and does not modify '*vid' if 'vlandev_ofp_port' is not a Linux - * VLAN device. Unless VLAN splinters are enabled, this is what this function - * always does.*/ -static ofp_port_t -vsp_vlandev_to_realdev(const struct ofproto_dpif *ofproto, - ofp_port_t vlandev_ofp_port, int *vid) - OVS_REQUIRES(ofproto->vsp_mutex) -{ - if (!hmap_is_empty(&ofproto->vlandev_map)) { - const struct vlan_splinter *vsp; - - vsp = vlandev_find(ofproto, vlandev_ofp_port); - if (vsp) { - if (vid) { - *vid = vsp->vid; - } - return vsp->realdev_ofp_port; - } - } - return 0; -} - -/* Given 'flow', a flow representing a packet received on 'ofproto', checks - * whether 'flow->in_port' represents a Linux VLAN device. If so, changes - * 'flow->in_port' to the "real" device backing the VLAN device, sets - * 'flow->vlan_tci' to the VLAN VID, and returns true. Optionally pushes the - * appropriate VLAN on 'packet' if provided. Otherwise (which is always the - * case unless VLAN splinters are enabled), returns false without making any - * changes. */ -bool -vsp_adjust_flow(const struct ofproto_dpif *ofproto, struct flow *flow, - struct dp_packet *packet) - OVS_EXCLUDED(ofproto->vsp_mutex) -{ - ofp_port_t realdev; - int vid; - - /* hmap_is_empty is thread safe. */ - if (hmap_is_empty(&ofproto->vlandev_map)) { - return false; - } - - ovs_mutex_lock(&ofproto->vsp_mutex); - realdev = vsp_vlandev_to_realdev(ofproto, flow->in_port.ofp_port, &vid); - ovs_mutex_unlock(&ofproto->vsp_mutex); - if (!realdev) { - return false; - } - - /* Cause the flow to be processed as if it came in on the real device with - * the VLAN device's VLAN ID. */ - flow->in_port.ofp_port = realdev; - flow->vlan_tci = htons((vid & VLAN_VID_MASK) | VLAN_CFI); - - if (packet) { - /* Make the packet resemble the flow, so that it gets sent to an - * OpenFlow controller properly, so that it looks correct for sFlow, - * and so that flow_extract() will get the correct vlan_tci if it is - * called on 'packet'. */ - eth_push_vlan(packet, htons(ETH_TYPE_VLAN), flow->vlan_tci); - } - - return true; -} - -static void -vsp_remove(struct ofport_dpif *port) -{ - struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto); - struct vlan_splinter *vsp; - - ovs_mutex_lock(&ofproto->vsp_mutex); - vsp = vlandev_find(ofproto, port->up.ofp_port); - if (vsp) { - hmap_remove(&ofproto->vlandev_map, &vsp->vlandev_node); - hmap_remove(&ofproto->realdev_vid_map, &vsp->realdev_vid_node); - free(vsp); - - port->realdev_ofp_port = 0; - } else { - VLOG_ERR("missing vlan device record"); - } - ovs_mutex_unlock(&ofproto->vsp_mutex); -} - -static void -vsp_add(struct ofport_dpif *port, ofp_port_t realdev_ofp_port, int vid) -{ - struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto); - - ovs_mutex_lock(&ofproto->vsp_mutex); - if (!vsp_vlandev_to_realdev(ofproto, port->up.ofp_port, NULL) - && (vsp_realdev_to_vlandev__(ofproto, realdev_ofp_port, htons(vid)) - == realdev_ofp_port)) { - struct vlan_splinter *vsp; - - vsp = xmalloc(sizeof *vsp); - vsp->realdev_ofp_port = realdev_ofp_port; - vsp->vlandev_ofp_port = port->up.ofp_port; - vsp->vid = vid; - - port->realdev_ofp_port = realdev_ofp_port; - - hmap_insert(&ofproto->vlandev_map, &vsp->vlandev_node, - hash_ofp_port(port->up.ofp_port)); - hmap_insert(&ofproto->realdev_vid_map, &vsp->realdev_vid_node, - hash_realdev_vid(realdev_ofp_port, vid)); - } else { - VLOG_ERR("duplicate vlan device record"); - } - ovs_mutex_unlock(&ofproto->vsp_mutex); -} static odp_port_t ofp_port_to_odp_port(const struct ofproto_dpif *ofproto, ofp_port_t ofp_port) @@ -5845,7 +5568,6 @@ const struct ofproto_class ofproto_dpif_class = { set_mac_table_config, set_mcast_snooping, set_mcast_snooping_port, - set_realdev, NULL, /* meter_get_features */ NULL, /* meter_set */ NULL, /* meter_get */ diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index 91bf463b0..adcbedb25 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -143,13 +143,6 @@ const char *group_dpif_get_selection_method(const struct group_dpif *group); uint64_t group_dpif_get_selection_method_param(const struct group_dpif *group); const struct field_array *group_dpif_get_fields(const struct group_dpif *group); -bool ofproto_has_vlan_splinters(const struct ofproto_dpif *); -ofp_port_t vsp_realdev_to_vlandev(const struct ofproto_dpif *, - ofp_port_t realdev_ofp_port, - ovs_be16 vlan_tci); -bool vsp_adjust_flow(const struct ofproto_dpif *, struct flow *, - struct dp_packet *packet); - int ofproto_dpif_execute_actions(struct ofproto_dpif *, const struct flow *, struct rule_dpif *, const struct ofpact *, size_t ofpacts_len, struct dp_packet *); diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index daa0077f4..d7fd50ef3 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -121,14 +121,6 @@ struct ofproto { * the flow table and reacquire the global lock. */ struct guarded_list rule_executes; /* Contains "struct rule_execute"s. */ - /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device - * drivers in old versions of Linux that do not properly support VLANs when - * VLAN devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - unsigned long int *vlan_bitmap; /* 4096-bit bitmap of in-use VLANs. */ - bool vlans_changed; /* True if new VLANs are in use. */ int min_mtu; /* Current MTU of non-internal ports. */ /* Groups. */ @@ -1704,25 +1696,6 @@ struct ofproto_class { int (*set_mcast_snooping_port)(struct ofproto *ofproto_, void *aux, const struct ofproto_mcast_snooping_port_settings *s); -/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device drivers - * in old versions of Linux that do not properly support VLANs when VLAN - * devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - - /* If 'realdev_ofp_port' is nonzero, then this function configures 'ofport' - * as a VLAN splinter port for VLAN 'vid', associated with the real device - * that has OpenFlow port number 'realdev_ofp_port'. - * - * If 'realdev_ofp_port' is zero, then this function deconfigures 'ofport' - * as a VLAN splinter port. - * - * This function should be NULL if an implementation does not support it. - */ - int (*set_realdev)(struct ofport *ofport, - ofp_port_t realdev_ofp_port, int vid); - /* ## ------------------------ ## */ /* ## OpenFlow meter functions ## */ /* ## ------------------------ ## */ diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 89e75d55f..ae527a4f6 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -560,8 +560,6 @@ ofproto_create(const char *datapath_name, const char *datapath_type, ovs_list_init(&ofproto->expirable); ofproto->connmgr = connmgr_create(ofproto, datapath_name, datapath_name); guarded_list_init(&ofproto->rule_executes); - ofproto->vlan_bitmap = NULL; - ofproto->vlans_changed = false; ofproto->min_mtu = INT_MAX; ovs_rwlock_init(&ofproto->groups_rwlock); hmap_init(&ofproto->groups); @@ -1558,8 +1556,6 @@ ofproto_destroy__(struct ofproto *ofproto) ovs_assert(hmap_is_empty(&ofproto->learned_cookies)); hmap_destroy(&ofproto->learned_cookies); - free(ofproto->vlan_bitmap); - ofproto->ofproto_class->dealloc(ofproto); } @@ -2445,9 +2441,6 @@ ofproto_port_unregister(struct ofproto *ofproto, ofp_port_t ofp_port) { struct ofport *port = ofproto_get_port(ofproto, ofp_port); if (port) { - if (port->ofproto->ofproto_class->set_realdev) { - port->ofproto->ofproto_class->set_realdev(port, 0, 0); - } if (port->ofproto->ofproto_class->set_stp_port) { port->ofproto->ofproto_class->set_stp_port(port, NULL); } @@ -4715,19 +4708,6 @@ add_flow_finish(struct ofproto *ofproto, struct ofproto_flow_mod *ofm, if (old_rule) { ovsrcu_postpone(remove_rule_rcu, old_rule); } else { - if (minimask_get_vid_mask(new_rule->cr.match.mask) == VLAN_VID_MASK) { - if (ofproto->vlan_bitmap) { - uint16_t vid = miniflow_get_vid(new_rule->cr.match.flow); - - if (!bitmap_is_set(ofproto->vlan_bitmap, vid)) { - bitmap_set1(ofproto->vlan_bitmap, vid); - ofproto->vlans_changed = true; - } - } else { - ofproto->vlans_changed = true; - } - } - ofmonitor_report(ofproto->connmgr, new_rule, NXFME_ADDED, 0, req ? req->ofconn : NULL, req ? req->request->xid : 0, NULL); @@ -7921,92 +7901,3 @@ ofproto_unixctl_init(void) unixctl_command_register("ofproto/list", "", 0, 0, ofproto_unixctl_list, NULL); } - -/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device drivers - * in old versions of Linux that do not properly support VLANs when VLAN - * devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - -/* Sets a 1-bit in the 4096-bit 'vlan_bitmap' for each VLAN ID that is matched - * (exactly) by an OpenFlow rule in 'ofproto'. */ -void -ofproto_get_vlan_usage(struct ofproto *ofproto, unsigned long int *vlan_bitmap) -{ - struct match match; - struct cls_rule target; - const struct oftable *oftable; - - match_init_catchall(&match); - match_set_vlan_vid_masked(&match, htons(VLAN_CFI), htons(VLAN_CFI)); - cls_rule_init(&target, &match, 0); - - free(ofproto->vlan_bitmap); - ofproto->vlan_bitmap = bitmap_allocate(4096); - ofproto->vlans_changed = false; - - OFPROTO_FOR_EACH_TABLE (oftable, ofproto) { - struct rule *rule; - - CLS_FOR_EACH_TARGET (rule, cr, &oftable->cls, &target, - CLS_MAX_VERSION) { - if (minimask_get_vid_mask(rule->cr.match.mask) == VLAN_VID_MASK) { - uint16_t vid = miniflow_get_vid(rule->cr.match.flow); - - bitmap_set1(vlan_bitmap, vid); - bitmap_set1(ofproto->vlan_bitmap, vid); - } - } - } - - cls_rule_destroy(&target); -} - -/* Returns true if new VLANs have come into use by the flow table since the - * last call to ofproto_get_vlan_usage(). - * - * We don't track when old VLANs stop being used. */ -bool -ofproto_has_vlan_usage_changed(const struct ofproto *ofproto) -{ - return ofproto->vlans_changed; -} - -/* Configures a VLAN splinter binding between the ports identified by OpenFlow - * port numbers 'vlandev_ofp_port' and 'realdev_ofp_port'. If - * 'realdev_ofp_port' is nonzero, then the VLAN device is enslaved to the real - * device as a VLAN splinter for VLAN ID 'vid'. If 'realdev_ofp_port' is zero, - * then the VLAN device is un-enslaved. */ -int -ofproto_port_set_realdev(struct ofproto *ofproto, ofp_port_t vlandev_ofp_port, - ofp_port_t realdev_ofp_port, int vid) -{ - struct ofport *ofport; - int error; - - ovs_assert(vlandev_ofp_port != realdev_ofp_port); - - ofport = ofproto_get_port(ofproto, vlandev_ofp_port); - if (!ofport) { - VLOG_WARN("%s: cannot set realdev on nonexistent port %"PRIu16, - ofproto->name, vlandev_ofp_port); - return EINVAL; - } - - if (!ofproto->ofproto_class->set_realdev) { - if (!vlandev_ofp_port) { - return 0; - } - VLOG_WARN("%s: vlan splinters not supported", ofproto->name); - return EOPNOTSUPP; - } - - error = ofproto->ofproto_class->set_realdev(ofport, realdev_ofp_port, vid); - if (error) { - VLOG_WARN("%s: setting realdev on port %"PRIu16" (%s) failed (%s)", - ofproto->name, vlandev_ofp_port, - netdev_get_name(ofport->netdev), ovs_strerror(error)); - } - return error; -} diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index 2d241c96d..85888726b 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -399,14 +399,6 @@ struct ofproto_bundle_settings { struct lacp_settings *lacp; /* Nonnull to enable LACP. */ struct lacp_slave_settings *lacp_slaves; /* Array of n_slaves elements. */ - - /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device - * drivers in old versions of Linux that do not properly support VLANs when - * VLAN devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - ofp_port_t realdev_ofp_port;/* OpenFlow port number of real device. */ }; int ofproto_bundle_register(struct ofproto *, void *aux, @@ -504,18 +496,6 @@ int ofproto_port_get_cfm_status(const struct ofproto *, ofp_port_t ofp_port, struct cfm_status *); -/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) - * - * This is deprecated. It is only for compatibility with broken device drivers - * in old versions of Linux that do not properly support VLANs when VLAN - * devices are not used. When broken device drivers are no longer in - * widespread use, we will delete these interfaces. */ - -void ofproto_get_vlan_usage(struct ofproto *, unsigned long int *vlan_bitmap); -bool ofproto_has_vlan_usage_changed(const struct ofproto *); -int ofproto_port_set_realdev(struct ofproto *, ofp_port_t vlandev_ofp_port, - ofp_port_t realdev_ofp_port, int vid); - /* Table configuration */ enum ofputil_table_miss ofproto_table_get_miss_config(const struct ofproto *, |