socsvn commit: r337268 - soc2018/sduo/head/sys/dev/vale_vlan

sduo at FreeBSD.org sduo at FreeBSD.org
Fri Jul 6 17:57:10 UTC 2018


Author: sduo
Date: Fri Jul  6 17:57:03 2018
New Revision: 337268
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=337268

Log:
  VALE vlan bug fixing

Modified:
  soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan.c
  soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_freebsd.c
  soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_kern.h
  soc2018/sduo/head/sys/dev/vale_vlan/vv_freebsd_interface.c
  soc2018/sduo/head/sys/dev/vale_vlan/vv_os_interface.h

Modified: soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan.c
==============================================================================
--- soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan.c	Fri Jul  6 14:40:31 2018	(r337267)
+++ soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan.c	Fri Jul  6 17:57:03 2018	(r337268)
@@ -95,7 +95,7 @@
 	}
 
 	/* first we retrieve the informations we need */
-	buf     = ft->ft_buf + ft->ft_offset;
+	buf     = (uint8_t *)ft->ft_buf + ft->ft_offset;
 	be_tpid = *(uint16_t *)(buf + TAG_PID);
 	if (be_tpid != htobe16(0x8100)) {
 		nm_prinf("Not an IEEE802.Q frame\n");
@@ -275,15 +275,15 @@
 				 conf->mod_bdg_auth_token);
 }
 
-static inline int
-reset_bdg(struct vale_vlan_conf *conf, const char *bdg_name)
-{
-
-	nm_prinf("Trying to reset bdg %s for conf %s\n", bdg_name,
-		 conf->conf_name);
-	return netmap_bdg_regops(bdg_name, NULL, NULL,
-				 conf->mod_bdg_auth_token);
-}
+// static inline int
+// reset_bdg(struct vale_vlan_conf *conf, const char *bdg_name)
+// {
+
+// 	nm_prinf("Trying to reset bdg %s for conf %s\n", bdg_name,
+// 		 conf->conf_name);
+// 	return netmap_bdg_regops(bdg_name, NULL, NULL,
+// 				 conf->mod_bdg_auth_token);
+// }
 
 #define MAX_VLAN_CONFS 4
 /* used to access currently active vlan confs */

Modified: soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_freebsd.c
==============================================================================
--- soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_freebsd.c	Fri Jul  6 14:40:31 2018	(r337267)
+++ soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_freebsd.c	Fri Jul  6 17:57:03 2018	(r337268)
@@ -1,11 +1,11 @@
+#include <sys/param.h>
+#include <sys/module.h>
 #include <sys/errno.h>
 #include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/param.h>
-#include <sys/sx.h>
 #include <sys/types.h>
 #include <sys/uio.h>
+#include <sys/lock.h>
+#include <sys/sx.h>
 
 #include <dev/vale_vlan/vale_vlan_kern.h>
 
@@ -51,12 +51,15 @@
 		break;
 
 	case MOD_UNLOAD:
+		sx_xlock(&vale_vlan_global_lock);
 		if (vale_vlan_use_count != 0) {
 			nm_prinf("vale_vlan: module can't be unloaded,"
 				 "as it is still in use\n");
 			error = EBUSY;
+			sx_xunlock(&vale_vlan_global_lock);
 			break;
 		}
+		sx_xunlock(&vale_vlan_global_lock);
 		destroy_dev(vale_vlan_cdev);
 		sx_destroy(&vale_vlan_global_lock);
 		break;
@@ -92,11 +95,12 @@
 
 	sx_xlock(&vale_vlan_global_lock);
 	vv_init_dev(vv_dev);
+	sx_xunlock(&vale_vlan_global_lock);
 	ret = devfs_set_cdevpriv(vv_dev, vale_vlan_dtor);
 	if (ret != 0) {
 		vv_free(vv_dev);
+		return EFAULT;
 	}
-	sx_xunlock(&vale_vlan_global_lock);
 
 	return ret;
 }
@@ -209,7 +213,7 @@
 	}
 
 	switch (cmd) {
-	case VALE_VLAN_IOCCTRL:
+	case VV_IOCCTRL:
 		sx_xlock(&vale_vlan_global_lock);
 		ret = vv_iocctrl(vv_dev, hdr);
 		sx_xunlock(&vale_vlan_global_lock);

Modified: soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_kern.h
==============================================================================
--- soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_kern.h	Fri Jul  6 14:40:31 2018	(r337267)
+++ soc2018/sduo/head/sys/dev/vale_vlan/vale_vlan_kern.h	Fri Jul  6 17:57:03 2018	(r337268)
@@ -1,45 +1,44 @@
 #ifndef VALE_VLAN_KERN_H
 #define VALE_VLAN_KERN_H
 
-#define WITH_VALE
-
 /* Import declarations needed by netmap */
 #if defined(__linux__)
 #include <bsd_glue.h>
 #elif defined(__FreeBSD__)
-#include <machine/bus.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_var.h>
-#include <net/vnet.h>
 #include <sys/cdefs.h>
-#include <sys/conf.h>
-#include <sys/endian.h>
+#include <sys/types.h>
 #include <sys/errno.h>
-#include <sys/filio.h>
-#include <sys/jail.h>
+#include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/conf.h>
+#include <sys/filio.h>
+#include <sys/sockio.h>
+#include <sys/socketvar.h>
 #include <sys/malloc.h>
-#include <sys/param.h>
 #include <sys/poll.h>
-#include <sys/refcount.h>
 #include <sys/rwlock.h>
-#include <sys/selinfo.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sockio.h>
+#include <sys/selinfo.h>
 #include <sys/sysctl.h>
+#include <sys/jail.h>
+#include <net/vnet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_types.h>
 #include <sys/time.h>
-#include <sys/types.h>
+#include <net/bpf.h>
+#include <machine/bus.h>
+#include <sys/endian.h>
+#include <sys/refcount.h>
 #endif /* FreeBSD */
 /* End of declarations needed by netmap */
 
 #include <dev/vale_vlan/vv_os_interface.h>
 #include <net/vale_vlan_user.h>
 
-#include <dev/netmap/netmap_kern.h>
+#define WITH_VALE
 #include <net/netmap.h>
+#include <dev/netmap/netmap_kern.h>
 
 struct vale_vlan_dev {
 	int selected_conf;

Modified: soc2018/sduo/head/sys/dev/vale_vlan/vv_freebsd_interface.c
==============================================================================
--- soc2018/sduo/head/sys/dev/vale_vlan/vv_freebsd_interface.c	Fri Jul  6 14:40:31 2018	(r337267)
+++ soc2018/sduo/head/sys/dev/vale_vlan/vv_freebsd_interface.c	Fri Jul  6 17:57:03 2018	(r337268)
@@ -1,5 +1,5 @@
-#include <sys/kernel.h>
 #include <sys/malloc.h>
+#include <sys/kernel.h>
 
 #include <dev/vale_vlan/vv_os_interface.h>
 

Modified: soc2018/sduo/head/sys/dev/vale_vlan/vv_os_interface.h
==============================================================================
--- soc2018/sduo/head/sys/dev/vale_vlan/vv_os_interface.h	Fri Jul  6 14:40:31 2018	(r337267)
+++ soc2018/sduo/head/sys/dev/vale_vlan/vv_os_interface.h	Fri Jul  6 17:57:03 2018	(r337268)
@@ -49,7 +49,7 @@
 	list_for_each_entry_safe(cursor_p, temp_p, head_p, entry_name)
 
 #elif defined(__FreeBSD__)
-#define vv_list_declare(head_struct_t, entry_struct_t)                          \
+#define vv_list_declare(head_struct_t, entry_struct_t)                         \
 	LIST_HEAD(head_struct_t, entry_struct_t)
 
 #define vv_list_head_init(head_p) LIST_INIT(head_p)


More information about the svn-soc-all mailing list