Adds the driver main files. These files implement netdev
registration, netdev functions and state maintenance of the
virtual NIC corresponding to the various events associated
with the Virtual Ethernet IOC (VEx) connection.
Signed-off-by: Ramachandra K [EMAIL PROTECTED]
---
drivers/infiniband/ulp/vnic/vnic_main.c | 1040 +++
drivers/infiniband/ulp/vnic/vnic_main.h | 152 +
2 files changed, 1192 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/ulp/vnic/vnic_main.c
b/drivers/infiniband/ulp/vnic/vnic_main.c
new file mode 100644
index 000..b87e00b
--- /dev/null
+++ b/drivers/infiniband/ulp/vnic/vnic_main.c
@@ -0,0 +1,1040 @@
+/*
+ * Copyright (c) 2006 SilverStorm Technologies Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/errno.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/skbuff.h
+#include linux/version.h
+#include linux/string.h
+#include linux/init.h
+#include linux/list.h
+#include linux/completion.h
+
+#include rdma/ib_cache.h
+
+#include vnic_util.h
+#include vnic_main.h
+#include vnic_netpath.h
+#include vnic_viport.h
+#include vnic_ib.h
+
+#define MODULEVERSION 0.1
+#define MODULEDETAILS Virtual NIC driver version MODULEVERSION
+
+MODULE_AUTHOR(SilverStorm Technologies Inc.);
+MODULE_DESCRIPTION(MODULEDETAILS);
+MODULE_LICENSE(Dual BSD/GPL);
+MODULE_SUPPORTED_DEVICE(SilverStorm Ethernet Virtual I/O Controller);
+
+u32 vnic_debug = 0x0;
+
+module_param(vnic_debug, uint, 0444);
+
+LIST_HEAD(vnic_list);
+
+const char driver[] = vnic;
+
+void vnic_connected(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_connected()\n);
+ vnic_npevent_queue_evt(netpath, VNICNP_CONNECTED);
+#ifdef CONFIG_INFINIBAND_VNIC_STATS
+ if (vnic-statistics.conn_time == 0) {
+ vnic-statistics.conn_time =
+ get_cycles() - vnic-statistics.start_time;
+ }
+ if (vnic-statistics.disconn_ref != 0) {
+ vnic-statistics.disconn_time +=
+ get_cycles() - vnic-statistics.disconn_ref;
+ vnic-statistics.disconn_num++;
+ vnic-statistics.disconn_ref = 0;
+ }
+#endif /* CONFIG_INFINIBAND_VNIC_STATS */
+}
+
+void vnic_disconnected(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_disconnected()\n);
+ vnic_npevent_queue_evt(netpath, VNICNP_DISCONNECTED);
+}
+
+void vnic_link_up(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_link_up()\n);
+ vnic_npevent_queue_evt(netpath, VNICNP_LINKUP);
+}
+
+void vnic_link_down(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_link_down()\n);
+ vnic_npevent_queue_evt(netpath, VNICNP_LINKDOWN);
+}
+
+void vnic_stop_xmit(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_stop_xmit()\n);
+ if (netpath == vnic-current_path) {
+ if (vnic-xmit_started) {
+ netif_stop_queue(vnic-netdevice);
+ vnic-xmit_started = 0;
+ }
+#ifdef CONFIG_INFINIBAND_VNIC_STATS
+ if (vnic-statistics.xmit_ref == 0) {
+ vnic-statistics.xmit_ref = get_cycles();
+ }
+#endif /* CONFIG_INFINIBAND_VNIC_STATS */
+ }
+ return;
+}
+
+void vnic_restart_xmit(struct vnic *vnic, struct netpath *netpath)
+{
+ VNIC_FUNCTION(vnic_restart_xmit()\n);
+ if (netpath == vnic-current_path) {
+ if (!vnic-xmit_started) {
+