2 * Copyright (c) 2010, 2011 Nicira Networks.
3 * Distributed under the terms of the GNU GPL version 2.
5 * Significant portions of this file may be copied from parts of the Linux
6 * kernel, by Linus Torvalds and others.
9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 #include <linux/dcache.h>
12 #include <linux/etherdevice.h>
14 #include <linux/if_vlan.h>
15 #include <linux/kernel.h>
16 #include <linux/list.h>
17 #include <linux/mutex.h>
18 #include <linux/percpu.h>
19 #include <linux/rtnetlink.h>
20 #include <linux/compat.h>
21 #include <linux/version.h>
24 #include "vport-internal_dev.h"
26 /* List of statically compiled vport implementations. Don't forget to also
27 * add yours to the list at the bottom of vport.h. */
28 static const struct vport_ops *base_vport_ops_list[] = {
33 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
38 static const struct vport_ops **vport_ops_list;
39 static int n_vport_types;
41 static struct hlist_head *dev_table;
42 #define VPORT_HASH_BUCKETS 1024
44 /* Both RTNL lock and vport_mutex need to be held when updating dev_table.
46 * If you use vport_locate and then perform some operations, you need to hold
47 * one of these locks if you don't want the vport to be deleted out from under
50 * If you get a reference to a vport through a datapath, it is protected
51 * by RCU and you need to hold rcu_read_lock instead when reading.
53 * If multiple locks are taken, the hierarchy is:
58 static DEFINE_MUTEX(vport_mutex);
61 * vport_lock - acquire vport lock
63 * Acquire global vport lock. See above comment about locking requirements
64 * and specific function definitions. May sleep.
68 mutex_lock(&vport_mutex);
72 * vport_unlock - release vport lock
74 * Release lock acquired with vport_lock.
76 void vport_unlock(void)
78 mutex_unlock(&vport_mutex);
81 #define ASSERT_VPORT() \
83 if (unlikely(!mutex_is_locked(&vport_mutex))) { \
84 pr_err("vport lock not held at %s (%d)\n", \
85 __FILE__, __LINE__); \
91 * vport_init - initialize vport subsystem
93 * Called at module load time to initialize the vport subsystem and any
94 * compiled in vport types.
101 dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
108 vport_ops_list = kmalloc(ARRAY_SIZE(base_vport_ops_list) *
109 sizeof(struct vport_ops *), GFP_KERNEL);
110 if (!vport_ops_list) {
112 goto error_dev_table;
115 for (i = 0; i < ARRAY_SIZE(base_vport_ops_list); i++) {
116 const struct vport_ops *new_ops = base_vport_ops_list[i];
119 err = new_ops->init();
124 vport_ops_list[n_vport_types++] = new_ops;
125 else if (new_ops->flags & VPORT_F_REQUIRED) {
140 * vport_exit - shutdown vport subsystem
142 * Called at module exit time to shutdown the vport subsystem and any
143 * initialized vport types.
145 void vport_exit(void)
149 for (i = 0; i < n_vport_types; i++) {
150 if (vport_ops_list[i]->exit)
151 vport_ops_list[i]->exit();
154 kfree(vport_ops_list);
159 * vport_user_mod - modify existing vport device (for userspace callers)
161 * @uport: New configuration for vport
163 * Modifies an existing device with the specified configuration (which is
164 * dependent on device type). This function is for userspace callers and
165 * assumes no locks are held.
167 int vport_user_mod(const struct odp_port __user *uport)
169 struct odp_port port;
173 if (copy_from_user(&port, uport, sizeof(port)))
176 port.devname[IFNAMSIZ - 1] = '\0';
180 vport = vport_locate(port.devname);
187 err = vport_mod(vport, &port);
196 * vport_user_stats_get - retrieve device stats (for userspace callers)
198 * @ustats_req: Stats request parameters.
200 * Retrieves transmit, receive, and error stats for the given device. This
201 * function is for userspace callers and assumes no locks are held.
203 int vport_user_stats_get(struct odp_vport_stats_req __user *ustats_req)
205 struct odp_vport_stats_req stats_req;
209 if (copy_from_user(&stats_req, ustats_req, sizeof(struct odp_vport_stats_req)))
212 stats_req.devname[IFNAMSIZ - 1] = '\0';
216 vport = vport_locate(stats_req.devname);
222 err = vport_get_stats(vport, &stats_req.stats);
228 if (copy_to_user(ustats_req, &stats_req, sizeof(struct odp_vport_stats_req)))
235 * vport_user_stats_set - sets offset device stats (for userspace callers)
237 * @ustats_req: Stats set parameters.
239 * Provides a set of transmit, receive, and error stats to be added as an
240 * offset to the collect data when stats are retreived. Some devices may not
241 * support setting the stats, in which case the result will always be
242 * -EOPNOTSUPP. This function is for userspace callers and assumes no locks
245 int vport_user_stats_set(struct odp_vport_stats_req __user *ustats_req)
247 struct odp_vport_stats_req stats_req;
251 if (copy_from_user(&stats_req, ustats_req, sizeof(struct odp_vport_stats_req)))
254 stats_req.devname[IFNAMSIZ - 1] = '\0';
259 vport = vport_locate(stats_req.devname);
265 err = vport_set_stats(vport, &stats_req.stats);
275 * vport_user_ether_get - retrieve device Ethernet address (for userspace callers)
277 * @uvport_ether: Ethernet address request parameters.
279 * Retrieves the Ethernet address of the given device. This function is for
280 * userspace callers and assumes no locks are held.
282 int vport_user_ether_get(struct odp_vport_ether __user *uvport_ether)
284 struct odp_vport_ether vport_ether;
288 if (copy_from_user(&vport_ether, uvport_ether, sizeof(struct odp_vport_ether)))
291 vport_ether.devname[IFNAMSIZ - 1] = '\0';
295 vport = vport_locate(vport_ether.devname);
302 memcpy(vport_ether.ether_addr, vport_get_addr(vport), ETH_ALEN);
309 if (copy_to_user(uvport_ether, &vport_ether, sizeof(struct odp_vport_ether)))
316 * vport_user_ether_set - set device Ethernet address (for userspace callers)
318 * @uvport_ether: Ethernet address request parameters.
320 * Sets the Ethernet address of the given device. Some devices may not support
321 * setting the Ethernet address, in which case the result will always be
322 * -EOPNOTSUPP. This function is for userspace callers and assumes no locks
325 int vport_user_ether_set(struct odp_vport_ether __user *uvport_ether)
327 struct odp_vport_ether vport_ether;
331 if (copy_from_user(&vport_ether, uvport_ether, sizeof(struct odp_vport_ether)))
334 vport_ether.devname[IFNAMSIZ - 1] = '\0';
339 vport = vport_locate(vport_ether.devname);
345 err = vport_set_addr(vport, vport_ether.ether_addr);
354 * vport_user_mtu_get - retrieve device MTU (for userspace callers)
356 * @uvport_mtu: MTU request parameters.
358 * Retrieves the MTU of the given device. This function is for userspace
359 * callers and assumes no locks are held.
361 int vport_user_mtu_get(struct odp_vport_mtu __user *uvport_mtu)
363 struct odp_vport_mtu vport_mtu;
367 if (copy_from_user(&vport_mtu, uvport_mtu, sizeof(struct odp_vport_mtu)))
370 vport_mtu.devname[IFNAMSIZ - 1] = '\0';
374 vport = vport_locate(vport_mtu.devname);
380 vport_mtu.mtu = vport_get_mtu(vport);
386 if (copy_to_user(uvport_mtu, &vport_mtu, sizeof(struct odp_vport_mtu)))
393 * vport_user_mtu_set - set device MTU (for userspace callers)
395 * @uvport_mtu: MTU request parameters.
397 * Sets the MTU of the given device. Some devices may not support setting the
398 * MTU, in which case the result will always be -EOPNOTSUPP. This function is
399 * for userspace callers and assumes no locks are held.
401 int vport_user_mtu_set(struct odp_vport_mtu __user *uvport_mtu)
403 struct odp_vport_mtu vport_mtu;
407 if (copy_from_user(&vport_mtu, uvport_mtu, sizeof(struct odp_vport_mtu)))
410 vport_mtu.devname[IFNAMSIZ - 1] = '\0';
415 vport = vport_locate(vport_mtu.devname);
421 err = vport_set_mtu(vport, vport_mtu.mtu);
429 static struct hlist_head *hash_bucket(const char *name)
431 unsigned int hash = full_name_hash(name, strlen(name));
432 return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)];
436 * vport_locate - find a port that has already been created
438 * @name: name of port to find
440 * Either RTNL or vport lock must be acquired before calling this function
441 * and held while using the found port. See the locking comments at the
444 struct vport *vport_locate(const char *name)
446 struct hlist_head *bucket = hash_bucket(name);
448 struct hlist_node *node;
450 if (unlikely(!mutex_is_locked(&vport_mutex) && !rtnl_is_locked())) {
451 pr_err("neither RTNL nor vport lock held in vport_locate\n");
457 hlist_for_each_entry(vport, node, bucket, hash_node)
458 if (!strcmp(name, vport_get_name(vport)))
468 static void register_vport(struct vport *vport)
470 hlist_add_head(&vport->hash_node, hash_bucket(vport_get_name(vport)));
473 static void unregister_vport(struct vport *vport)
475 hlist_del(&vport->hash_node);
478 static void release_vport(struct kobject *kobj)
480 struct vport *p = container_of(kobj, struct vport, kobj);
484 static struct kobj_type brport_ktype = {
486 .sysfs_ops = &brport_sysfs_ops,
488 .release = release_vport
492 * vport_alloc - allocate and initialize new vport
494 * @priv_size: Size of private data area to allocate.
495 * @ops: vport device ops
497 * Allocate and initialize a new vport defined by @ops. The vport will contain
498 * a private data area of size @priv_size that can be accessed using
499 * vport_priv(). vports that are no longer needed should be released with
502 struct vport *vport_alloc(int priv_size, const struct vport_ops *ops, const struct vport_parms *parms)
507 alloc_size = sizeof(struct vport);
509 alloc_size = ALIGN(alloc_size, VPORT_ALIGN);
510 alloc_size += priv_size;
513 vport = kzalloc(alloc_size, GFP_KERNEL);
515 return ERR_PTR(-ENOMEM);
517 vport->dp = parms->dp;
518 vport->port_no = parms->port_no;
519 atomic_set(&vport->sflow_pool, 0);
522 /* Initialize kobject for bridge. This will be added as
523 * /sys/class/net/<devname>/brport later, if sysfs is enabled. */
524 vport->kobj.kset = NULL;
525 kobject_init(&vport->kobj, &brport_ktype);
527 if (vport->ops->flags & VPORT_F_GEN_STATS) {
528 vport->percpu_stats = alloc_percpu(struct vport_percpu_stats);
529 if (!vport->percpu_stats)
530 return ERR_PTR(-ENOMEM);
532 spin_lock_init(&vport->stats_lock);
539 * vport_free - uninitialize and free vport
541 * @vport: vport to free
543 * Frees a vport allocated with vport_alloc() when it is no longer needed.
545 void vport_free(struct vport *vport)
547 if (vport->ops->flags & VPORT_F_GEN_STATS)
548 free_percpu(vport->percpu_stats);
550 kobject_put(&vport->kobj);
554 * vport_add - add vport device (for kernel callers)
556 * @parms: Information about new vport.
558 * Creates a new vport with the specified configuration (which is dependent on
559 * device type) and attaches it to a datapath. Both RTNL and vport locks must
562 struct vport *vport_add(const struct vport_parms *parms)
571 for (i = 0; i < n_vport_types; i++) {
572 if (!strcmp(vport_ops_list[i]->type, parms->type)) {
573 vport = vport_ops_list[i]->create(parms);
575 err = PTR_ERR(vport);
579 register_vport(vport);
591 * vport_mod - modify existing vport device (for kernel callers)
593 * @vport: vport to modify.
594 * @port: New configuration.
596 * Modifies an existing device with the specified configuration (which is
597 * dependent on device type). Both RTNL and vport locks must be held.
599 int vport_mod(struct vport *vport, struct odp_port *port)
604 if (vport->ops->modify)
605 return vport->ops->modify(vport, port);
611 * vport_del - delete existing vport device (for kernel callers)
613 * @vport: vport to delete.
615 * Detaches @vport from its datapath and destroys it. It is possible to fail
616 * for reasons such as lack of memory. Both RTNL and vport locks must be held.
618 int vport_del(struct vport *vport)
623 unregister_vport(vport);
625 return vport->ops->destroy(vport);
629 * vport_set_mtu - set device MTU (for kernel callers)
631 * @vport: vport on which to set MTU.
634 * Sets the MTU of the given device. Some devices may not support setting the
635 * MTU, in which case the result will always be -EOPNOTSUPP. RTNL lock must
638 int vport_set_mtu(struct vport *vport, int mtu)
645 if (vport->ops->set_mtu) {
648 ret = vport->ops->set_mtu(vport, mtu);
650 if (!ret && !is_internal_vport(vport))
651 set_internal_devs_mtu(vport->dp);
659 * vport_set_addr - set device Ethernet address (for kernel callers)
661 * @vport: vport on which to set Ethernet address.
662 * @addr: New address.
664 * Sets the Ethernet address of the given device. Some devices may not support
665 * setting the Ethernet address, in which case the result will always be
666 * -EOPNOTSUPP. RTNL lock must be held.
668 int vport_set_addr(struct vport *vport, const unsigned char *addr)
672 if (!is_valid_ether_addr(addr))
673 return -EADDRNOTAVAIL;
675 if (vport->ops->set_addr)
676 return vport->ops->set_addr(vport, addr);
682 * vport_set_stats - sets offset device stats (for kernel callers)
684 * @vport: vport on which to set stats
685 * @stats: stats to set
687 * Provides a set of transmit, receive, and error stats to be added as an
688 * offset to the collect data when stats are retreived. Some devices may not
689 * support setting the stats, in which case the result will always be
690 * -EOPNOTSUPP. RTNL lock must be held.
692 int vport_set_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
696 if (vport->ops->flags & VPORT_F_GEN_STATS) {
697 spin_lock_bh(&vport->stats_lock);
698 vport->offset_stats = *stats;
699 spin_unlock_bh(&vport->stats_lock);
707 * vport_get_name - retrieve device name
709 * @vport: vport from which to retrieve the name.
711 * Retrieves the name of the given device. Either RTNL lock or rcu_read_lock
712 * must be held for the entire duration that the name is in use.
714 const char *vport_get_name(const struct vport *vport)
716 return vport->ops->get_name(vport);
720 * vport_get_type - retrieve device type
722 * @vport: vport from which to retrieve the type.
724 * Retrieves the type of the given device. Either RTNL lock or rcu_read_lock
725 * must be held for the entire duration that the type is in use.
727 const char *vport_get_type(const struct vport *vport)
729 return vport->ops->type;
733 * vport_get_addr - retrieve device Ethernet address (for kernel callers)
735 * @vport: vport from which to retrieve the Ethernet address.
737 * Retrieves the Ethernet address of the given device. Either RTNL lock or
738 * rcu_read_lock must be held for the entire duration that the Ethernet address
741 const unsigned char *vport_get_addr(const struct vport *vport)
743 return vport->ops->get_addr(vport);
747 * vport_get_kobj - retrieve associated kobj
749 * @vport: vport from which to retrieve the associated kobj
751 * Retrieves the associated kobj or null if no kobj. The returned kobj is
752 * valid for as long as the vport exists.
754 struct kobject *vport_get_kobj(const struct vport *vport)
756 if (vport->ops->get_kobj)
757 return vport->ops->get_kobj(vport);
762 static int vport_call_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
767 err = vport->ops->get_stats(vport, stats);
774 * vport_get_stats - retrieve device stats (for kernel callers)
776 * @vport: vport from which to retrieve the stats
777 * @stats: location to store stats
779 * Retrieves transmit, receive, and error stats for the given device.
781 int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
785 if (!(vport->ops->flags & VPORT_F_GEN_STATS))
786 return vport_call_get_stats(vport, stats);
788 /* We potentially have 3 sources of stats that need to be
789 * combined: those we have collected (split into err_stats and
790 * percpu_stats), offset_stats from set_stats(), and device
791 * error stats from get_stats() (for errors that happen
792 * downstream and therefore aren't reported through our
793 * vport_record_error() function). */
795 spin_lock_bh(&vport->stats_lock);
797 *stats = vport->offset_stats;
799 stats->rx_errors += vport->err_stats.rx_errors;
800 stats->tx_errors += vport->err_stats.tx_errors;
801 stats->tx_dropped += vport->err_stats.tx_dropped;
802 stats->rx_dropped += vport->err_stats.rx_dropped;
804 spin_unlock_bh(&vport->stats_lock);
806 if (vport->ops->get_stats) {
807 struct rtnl_link_stats64 dev_stats;
810 err = vport_call_get_stats(vport, &dev_stats);
814 stats->rx_errors += dev_stats.rx_errors;
815 stats->tx_errors += dev_stats.tx_errors;
816 stats->rx_dropped += dev_stats.rx_dropped;
817 stats->tx_dropped += dev_stats.tx_dropped;
818 stats->multicast += dev_stats.multicast;
819 stats->collisions += dev_stats.collisions;
820 stats->rx_length_errors += dev_stats.rx_length_errors;
821 stats->rx_over_errors += dev_stats.rx_over_errors;
822 stats->rx_crc_errors += dev_stats.rx_crc_errors;
823 stats->rx_frame_errors += dev_stats.rx_frame_errors;
824 stats->rx_fifo_errors += dev_stats.rx_fifo_errors;
825 stats->rx_missed_errors += dev_stats.rx_missed_errors;
826 stats->tx_aborted_errors += dev_stats.tx_aborted_errors;
827 stats->tx_carrier_errors += dev_stats.tx_carrier_errors;
828 stats->tx_fifo_errors += dev_stats.tx_fifo_errors;
829 stats->tx_heartbeat_errors += dev_stats.tx_heartbeat_errors;
830 stats->tx_window_errors += dev_stats.tx_window_errors;
831 stats->rx_compressed += dev_stats.rx_compressed;
832 stats->tx_compressed += dev_stats.tx_compressed;
835 for_each_possible_cpu(i) {
836 const struct vport_percpu_stats *percpu_stats;
837 struct vport_percpu_stats local_stats;
840 percpu_stats = per_cpu_ptr(vport->percpu_stats, i);
843 seqcount = read_seqcount_begin(&percpu_stats->seqlock);
844 local_stats = *percpu_stats;
845 } while (read_seqcount_retry(&percpu_stats->seqlock, seqcount));
847 stats->rx_bytes += local_stats.rx_bytes;
848 stats->rx_packets += local_stats.rx_packets;
849 stats->tx_bytes += local_stats.tx_bytes;
850 stats->tx_packets += local_stats.tx_packets;
857 * vport_get_flags - retrieve device flags
859 * @vport: vport from which to retrieve the flags
861 * Retrieves the flags of the given device. Either RTNL lock or rcu_read_lock
864 unsigned vport_get_flags(const struct vport *vport)
866 return vport->ops->get_dev_flags(vport);
870 * vport_get_flags - check whether device is running
872 * @vport: vport on which to check status.
874 * Checks whether the given device is running. Either RTNL lock or
875 * rcu_read_lock must be held.
877 int vport_is_running(const struct vport *vport)
879 return vport->ops->is_running(vport);
883 * vport_get_flags - retrieve device operating state
885 * @vport: vport from which to check status
887 * Retrieves the RFC2863 operstate of the given device. Either RTNL lock or
888 * rcu_read_lock must be held.
890 unsigned char vport_get_operstate(const struct vport *vport)
892 return vport->ops->get_operstate(vport);
896 * vport_get_ifindex - retrieve device system interface index
898 * @vport: vport from which to retrieve index
900 * Retrieves the system interface index of the given device or 0 if
901 * the device does not have one (in the case of virtual ports).
902 * Returns a negative index on error. Either RTNL lock or
903 * rcu_read_lock must be held.
905 int vport_get_ifindex(const struct vport *vport)
907 if (vport->ops->get_ifindex)
908 return vport->ops->get_ifindex(vport);
914 * vport_get_iflink - retrieve device system link index
916 * @vport: vport from which to retrieve index
918 * Retrieves the system link index of the given device. The link is the index
919 * of the interface on which the packet will actually be sent. In most cases
920 * this is the same as the ifindex but may be different for tunnel devices.
921 * Returns a negative index on error. Either RTNL lock or rcu_read_lock must
924 int vport_get_iflink(const struct vport *vport)
926 if (vport->ops->get_iflink)
927 return vport->ops->get_iflink(vport);
929 /* If we don't have an iflink, use the ifindex. In most cases they
931 return vport_get_ifindex(vport);
935 * vport_get_mtu - retrieve device MTU (for kernel callers)
937 * @vport: vport from which to retrieve MTU
939 * Retrieves the MTU of the given device. Either RTNL lock or rcu_read_lock
942 int vport_get_mtu(const struct vport *vport)
944 return vport->ops->get_mtu(vport);
948 * vport_get_config - retrieve device configuration
950 * @vport: vport from which to retrieve the configuration.
951 * @config: buffer to store config, which must be at least the length
952 * of VPORT_CONFIG_SIZE.
954 * Retrieves the configuration of the given device. Either RTNL lock or
955 * rcu_read_lock must be held.
957 void vport_get_config(const struct vport *vport, void *config)
959 if (vport->ops->get_config)
960 vport->ops->get_config(vport, config);
964 * vport_receive - pass up received packet to the datapath for processing
966 * @vport: vport that received the packet
967 * @skb: skb that was received
969 * Must be called with rcu_read_lock. The packet cannot be shared and
970 * skb->data should point to the Ethernet header. The caller must have already
971 * called compute_ip_summed() to initialize the checksumming fields.
973 void vport_receive(struct vport *vport, struct sk_buff *skb)
975 if (vport->ops->flags & VPORT_F_GEN_STATS) {
976 struct vport_percpu_stats *stats;
979 stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id());
981 write_seqcount_begin(&stats->seqlock);
983 stats->rx_bytes += skb->len;
984 write_seqcount_end(&stats->seqlock);
989 if (!(vport->ops->flags & VPORT_F_FLOW))
990 OVS_CB(skb)->flow = NULL;
992 if (!(vport->ops->flags & VPORT_F_TUN_ID))
993 OVS_CB(skb)->tun_id = 0;
995 dp_process_received_packet(vport, skb);
998 static inline unsigned packet_length(const struct sk_buff *skb)
1000 unsigned length = skb->len - ETH_HLEN;
1002 if (skb->protocol == htons(ETH_P_8021Q))
1003 length -= VLAN_HLEN;
1009 * vport_send - send a packet on a device
1011 * @vport: vport on which to send the packet
1014 * Sends the given packet and returns the length of data sent. Either RTNL
1015 * lock or rcu_read_lock must be held.
1017 int vport_send(struct vport *vport, struct sk_buff *skb)
1022 mtu = vport_get_mtu(vport);
1023 if (unlikely(packet_length(skb) > mtu && !skb_is_gso(skb))) {
1024 if (net_ratelimit())
1025 pr_warn("%s: dropped over-mtu packet: %d > %d\n",
1026 dp_name(vport->dp), packet_length(skb), mtu);
1030 sent = vport->ops->send(vport, skb);
1032 if (vport->ops->flags & VPORT_F_GEN_STATS && sent > 0) {
1033 struct vport_percpu_stats *stats;
1036 stats = per_cpu_ptr(vport->percpu_stats, smp_processor_id());
1038 write_seqcount_begin(&stats->seqlock);
1039 stats->tx_packets++;
1040 stats->tx_bytes += sent;
1041 write_seqcount_end(&stats->seqlock);
1050 vport_record_error(vport, VPORT_E_TX_DROPPED);
1055 * vport_record_error - indicate device error to generic stats layer
1057 * @vport: vport that encountered the error
1058 * @err_type: one of enum vport_err_type types to indicate the error type
1060 * If using the vport generic stats layer indicate that an error of the given
1063 void vport_record_error(struct vport *vport, enum vport_err_type err_type)
1065 if (vport->ops->flags & VPORT_F_GEN_STATS) {
1067 spin_lock_bh(&vport->stats_lock);
1070 case VPORT_E_RX_DROPPED:
1071 vport->err_stats.rx_dropped++;
1074 case VPORT_E_RX_ERROR:
1075 vport->err_stats.rx_errors++;
1078 case VPORT_E_TX_DROPPED:
1079 vport->err_stats.tx_dropped++;
1082 case VPORT_E_TX_ERROR:
1083 vport->err_stats.tx_errors++;
1087 spin_unlock_bh(&vport->stats_lock);