[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] Update sfc_netback driver to match sfc_resource 3.0.2.2074



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262956037 0
# Node ID 6061d56155223f92362420ec9a5a4dbe933efa60
# Parent  b8c2a9aacba6d9c50847d419bc6cfedc8fc4c750
Update sfc_netback driver to match sfc_resource 3.0.2.2074
Add support for direct guest access and acceleration of SFC9000 series
NICs.
Improve handling of NIC reset in sfc_netback
Remove nic_index state and replace with if_index from struct
net_device Remove duplication of header files with sfc_resource driver

Signed-off-by: Kieran Mansley <kmansley@xxxxxxxxxxxxxx>
---
 drivers/xen/sfc_netback/ci/driver/resource/efx_vi.h |  273 ----------------
 drivers/xen/sfc_netback/ci/efhw/common.h            |   98 -----
 drivers/xen/sfc_netback/ci/efhw/common_sysdep.h     |   71 ----
 drivers/xen/sfc_netback/ci/efhw/debug.h             |   84 ----
 drivers/xen/sfc_netback/ci/efhw/efhw_config.h       |   43 --
 drivers/xen/sfc_netback/ci/efhw/efhw_types.h        |  337 --------------------
 drivers/xen/sfc_netback/ci/efhw/hardware_sysdep.h   |   86 -----
 drivers/xen/sfc_netback/ci/efhw/iopage_types.h      |  195 -----------
 drivers/xen/sfc_netback/ci/efhw/public.h            |   83 ----
 drivers/xen/sfc_netback/ci/efhw/sysdep.h            |   72 ----
 drivers/xen/sfc_netback/ci/efrm/nic_table.h         |   98 -----
 drivers/xen/sfc_netback/ci/efrm/sysdep.h            |   54 ---
 drivers/xen/sfc_netback/ci/efrm/sysdep_linux.h      |  267 ---------------
 drivers/xen/sfc_netback/Makefile                    |    2 
 drivers/xen/sfc_netback/accel.h                     |    2 
 drivers/xen/sfc_netback/accel_solarflare.c          |   92 +++--
 drivers/xen/sfc_netfront/accel_vi.c                 |    6 
 drivers/xen/sfc_netutil/accel_msg_iface.h           |    1 
 18 files changed, 64 insertions(+), 1800 deletions(-)

diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/Makefile
--- a/drivers/xen/sfc_netback/Makefile  Fri Jan 08 13:06:22 2010 +0000
+++ b/drivers/xen/sfc_netback/Makefile  Fri Jan 08 13:07:17 2010 +0000
@@ -1,4 +1,4 @@ EXTRA_CFLAGS += -Idrivers/xen/sfc_netbac
-EXTRA_CFLAGS += -Idrivers/xen/sfc_netback -Idrivers/xen/sfc_netutil 
-Idrivers/xen/netback -Idrivers/net/sfc
+EXTRA_CFLAGS += -Idrivers/xen/sfc_netback -Idrivers/xen/sfc_netutil 
-Idrivers/xen/netback -Idrivers/net/sfc -Idrivers/net/sfc/sfc_resource
 EXTRA_CFLAGS += -D__ci_driver__ 
 EXTRA_CFLAGS += -DEFX_USE_KCOMPAT
 EXTRA_CFLAGS += -Werror
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/accel.h
--- a/drivers/xen/sfc_netback/accel.h   Fri Jan 08 13:06:22 2010 +0000
+++ b/drivers/xen/sfc_netback/accel.h   Fri Jan 08 13:07:17 2010 +0000
@@ -123,8 +123,6 @@ struct netback_accel {
        enum net_accel_hw_type hw_type;
        /*! State of allocation */             
        int hw_state;
-       /*! Index into ci_driver.nics[] for this interface */
-       int nic_index;
        /*! How to set up the acceleration for this hardware */
        int (*accel_setup)(struct netback_accel *); 
        /*! And how to stop it. */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/accel_solarflare.c
--- a/drivers/xen/sfc_netback/accel_solarflare.c        Fri Jan 08 13:06:22 
2010 +0000
+++ b/drivers/xen/sfc_netback/accel_solarflare.c        Fri Jan 08 13:07:17 
2010 +0000
@@ -87,7 +87,6 @@ struct driverlink_port {
        enum net_accel_hw_type type;
        struct net_device *net_dev;
        struct efx_dl_device *efx_dl_dev;
-       int nic_index;
        void *fwd_priv;
 };
 
@@ -164,25 +163,6 @@ static struct netback_accel_hooks accel_
 };
 
 
-/*
- * Handy helper which given an efx_dl_device works out which
- * efab_nic_t index into efrm_nic_table.nics[] it corresponds to 
- */
-static int efx_device_to_efab_nic_index(struct efx_dl_device *efx_dl_dev) 
-{
-       int i, rc = -1;
-       struct efhw_nic *nic;
-
-       EFRM_FOR_EACH_NIC(i, nic) {
-               if (nic != NULL && nic->net_driver_dev != NULL &&
-                   nic->net_driver_dev->pci_dev == efx_dl_dev->pci_dev)
-                       rc = i;
-       }
-
-       return rc;
-}
-
-
 /* Driver link probe - register our callbacks */
 static int bend_dl_probe(struct efx_dl_device *efx_dl_dev,
                         const struct net_device *net_dev,
@@ -199,6 +179,8 @@ static int bend_dl_probe(struct efx_dl_d
                type = NET_ACCEL_MSG_HWTYPE_FALCON_A;
        else if (strcmp(silicon_rev, "falcon/b0") == 0)
                type = NET_ACCEL_MSG_HWTYPE_FALCON_B;
+       else if (strcmp(silicon_rev, "siena/a0") == 0)
+               type = NET_ACCEL_MSG_HWTYPE_SIENA_A;
        else {
                EPRINTK("%s: unsupported silicon %s\n", __FUNCTION__,
                        silicon_rev);
@@ -215,17 +197,6 @@ static int bend_dl_probe(struct efx_dl_d
 
        port->efx_dl_dev = efx_dl_dev;
        efx_dl_dev->priv = port;
-
-       port->nic_index = efx_device_to_efab_nic_index(efx_dl_dev);
-       if (port->nic_index < 0) {
-               /*
-                * This can happen in theory if the resource driver
-                * failed to initialise properly
-                */
-               EPRINTK("%s: nic structure not found\n", __FUNCTION__);
-               rc = -EINVAL;
-               goto fail2;
-       }
 
        port->fwd_priv = netback_accel_init_fwd_port();
        if (port->fwd_priv == NULL) {
@@ -311,11 +282,65 @@ static void bend_dl_remove(struct efx_dl
 }
 
 
+static void bend_dl_reset_suspend(struct efx_dl_device *efx_dl_dev)
+{
+       struct driverlink_port *port;
+
+       DPRINTK("Driverlink reset suspend.\n");
+
+       mutex_lock(&accel_mutex);
+
+       port = (struct driverlink_port *)efx_dl_dev->priv;
+       BUG_ON(list_empty(&dl_ports));
+       BUG_ON(port == NULL);
+       BUG_ON(port->efx_dl_dev != efx_dl_dev);
+
+       netback_disconnect_accelerator(0, port->net_dev->name);
+       mutex_unlock(&accel_mutex);
+}
+
+
+static void bend_dl_reset_resume(struct efx_dl_device *efx_dl_dev, int ok)
+{
+       int rc;
+       struct driverlink_port *port;
+
+       DPRINTK("Driverlink reset resume.\n");
+       
+       if (!ok)
+               return;
+
+       port = (struct driverlink_port *)efx_dl_dev->priv;
+       BUG_ON(list_empty(&dl_ports));
+       BUG_ON(port == NULL);
+       BUG_ON(port->efx_dl_dev != efx_dl_dev);
+
+       rc = netback_connect_accelerator(NETBACK_ACCEL_VERSION, 0,
+                                        port->net_dev->name, &accel_hooks);
+       if (rc != 0) {
+               EPRINTK("Xen netback accelerator version mismatch\n");
+
+               mutex_lock(&accel_mutex);
+               list_del(&port->link);
+               mutex_unlock(&accel_mutex);
+
+               efx_dl_unregister_callbacks(efx_dl_dev, &bend_dl_callbacks);
+
+               netback_accel_shutdown_fwd_port(port->fwd_priv);
+
+               efx_dl_dev->priv = NULL;
+               kfree(port);
+       }
+}
+
+
 static struct efx_dl_driver bend_dl_driver = 
        {
                .name = "SFC Xen backend",
                .probe = bend_dl_probe,
                .remove = bend_dl_remove,
+               .reset_suspend = bend_dl_reset_suspend,
+               .reset_resume = bend_dl_reset_resume
        };
 
 
@@ -368,8 +393,6 @@ int netback_accel_sf_hwtype(struct netba
                        bend->accel_setup = netback_accel_setup_vnic_hw;
                        bend->accel_shutdown = netback_accel_shutdown_vnic_hw;
                        bend->fwd_priv = port->fwd_priv;
-                       /* This is just needed to pass to efx_vi_alloc */
-                       bend->nic_index = port->nic_index;
                        bend->net_dev = port->net_dev;
                        mutex_unlock(&accel_mutex);
                        return 0;
@@ -496,7 +519,7 @@ static int ef_get_vnic(struct netback_ac
 
        accel_hw_priv = bend->accel_hw_priv;
 
-       rc = efx_vi_alloc(&accel_hw_priv->efx_vih, bend->nic_index);
+       rc = efx_vi_alloc(&accel_hw_priv->efx_vih, bend->net_dev->ifindex);
        if (rc != 0) {
                EPRINTK("%s: efx_vi_alloc failed %d\n", __FUNCTION__, rc);
                free_page_state(bend);
@@ -745,6 +768,7 @@ static int netback_accel_hwinfo(struct n
                rc = ef_bend_hwinfo_falcon_a(bend, &msgvi->resources.falcon_a);
                break;
        case NET_ACCEL_MSG_HWTYPE_FALCON_B:
+       case NET_ACCEL_MSG_HWTYPE_SIENA_A:
                rc = ef_bend_hwinfo_falcon_b(bend, &msgvi->resources.falcon_b);
                break;
        case NET_ACCEL_MSG_HWTYPE_NONE:
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/driver/resource/efx_vi.h
--- a/drivers/xen/sfc_netback/ci/driver/resource/efx_vi.h       Fri Jan 08 
13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file contains public EFX VI API to Solarflare resource manager.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_DRIVER_RESOURCE_EFX_VI_H__
-#define __CI_DRIVER_RESOURCE_EFX_VI_H__
-
-/* Default size of event queue in the efx_vi resource.  Copied from
- * CI_CFG_NETIF_EVENTQ_SIZE */
-#define EFX_VI_EVENTQ_SIZE_DEFAULT 1024
-
-extern int efx_vi_eventq_size;
-
-/**************************************************************************
- * efx_vi_state types, allocation and free
- **************************************************************************/
-
-/*! Handle for refering to a efx_vi */
-struct efx_vi_state;
-
-/*!
- * Allocate an efx_vi, including event queue and pt_endpoint
- *
- * \param vih_out Pointer to a handle that is set on success
- * \param nic_index Index of NIC to apply this resource to
- * \return Zero on success (and vih_out set), non-zero on failure.
- */
-extern int
-efx_vi_alloc(struct efx_vi_state **vih_out, int nic_index);
-
-/*!
- * Free a previously allocated efx_vi
- *
- * \param vih The handle of the efx_vi to free
- */
-extern void
-efx_vi_free(struct efx_vi_state *vih);
-
-/*!
- * Reset a previously allocated efx_vi
- *
- * \param vih The handle of the efx_vi to reset
- */
-extern void
-efx_vi_reset(struct efx_vi_state *vih);
-
-/**************************************************************************
- * efx_vi_eventq types and functions
- **************************************************************************/
-
-/*!
- * Register a function to receive callbacks when event queue timeouts
- * or wakeups occur.  Only one function per efx_vi can be registered
- * at once.
- *
- * \param vih The handle to identify the efx_vi
- * \param callback The function to callback
- * \param context An argument to pass to the callback function
- * \return Zero on success, non-zero on failure.
- */
-extern int
-efx_vi_eventq_register_callback(struct efx_vi_state *vih,
-                               void (*callback)(void *context, int is_timeout),
-                               void *context);
-
-/*!
- * Remove the current eventq timeout or wakeup callback function
- *
- * \param vih The handle to identify the efx_vi
- * \return Zero on success, non-zero on failure
- */
-extern int
-efx_vi_eventq_kill_callback(struct efx_vi_state *vih);
-
-/**************************************************************************
- * efx_vi_dma_map types and functions
- **************************************************************************/
-
-/*!
- * Handle for refering to a efx_vi
- */
-struct efx_vi_dma_map_state;
-
-/*!
- * Map a list of buffer pages so they are registered with the hardware
- *
- * \param vih The handle to identify the efx_vi
- * \param addrs An array of page pointers to map
- * \param n_addrs Length of the page pointer array.  Must be a power of two.
- * \param dmh_out Set on success to a handle used to refer to this mapping
- * \return Zero on success, non-zero on failure.
- */
-extern int
-efx_vi_dma_map_pages(struct efx_vi_state *vih, struct page **pages,
-                        int n_pages, struct efx_vi_dma_map_state **dmh_out);
-extern int
-efx_vi_dma_map_addrs(struct efx_vi_state *vih,
-                    unsigned long long *dev_bus_addrs, int n_pages,
-                    struct efx_vi_dma_map_state **dmh_out);
-
-/*!
- * Unmap a previously mapped set of pages so they are no longer registered
- * with the hardware.
- *
- * \param vih The handle to identify the efx_vi
- * \param dmh The handle to identify the dma mapping
- */
-extern void
-efx_vi_dma_unmap_pages(struct efx_vi_state *vih,
-                      struct efx_vi_dma_map_state *dmh);
-extern void
-efx_vi_dma_unmap_addrs(struct efx_vi_state *vih,
-                      struct efx_vi_dma_map_state *dmh);
-
-/*!
- * Retrieve the buffer address of the mapping
- *
- * \param vih The handle to identify the efx_vi
- * \param dmh The handle to identify the buffer mapping
- * \return The buffer address on success, or zero on failure
- */
-extern unsigned
-efx_vi_dma_get_map_addr(struct efx_vi_state *vih,
-                       struct efx_vi_dma_map_state *dmh);
-
-/**************************************************************************
- * efx_vi filter functions
- **************************************************************************/
-
-#define EFX_VI_STATIC_FILTERS 32
-
-/*! Handle to refer to a filter instance */
-struct filter_resource_t;
-
-/*!
- * Allocate and add a filter
- *
- * \param vih The handle to identify the efx_vi
- * \param protocol The protocol of the new filter: UDP or TCP
- * \param ip_addr_be32 The local ip address of the filter
- * \param port_le16 The local port of the filter
- * \param fh_out Set on success to be a handle to refer to this filter
- * \return Zero on success, non-zero on failure.
- */
-extern int
-efx_vi_filter(struct efx_vi_state *vih, int protocol, unsigned ip_addr_be32,
-             int port_le16, struct filter_resource_t **fh_out);
-
-/*!
- * Remove a filter and free resources associated with it
- *
- * \param vih The handle to identify the efx_vi
- * \param fh The handle to identify the filter
- * \return Zero on success, non-zero on failure
- */
-extern int
-efx_vi_filter_stop(struct efx_vi_state *vih, struct filter_resource_t *fh);
-
-/**************************************************************************
- * efx_vi hw resources types and functions
- **************************************************************************/
-
-/*! Constants for the type field in efx_vi_hw_resource */
-#define EFX_VI_HW_RESOURCE_TXDMAQ    0x0       /* PFN of TX DMA Q */
-#define EFX_VI_HW_RESOURCE_RXDMAQ    0x1       /* PFN of RX DMA Q */
-#define EFX_VI_HW_RESOURCE_EVQTIMER  0x4       /* Address of event q timer */
-
-/* Address of event q pointer (EF1) */
-#define EFX_VI_HW_RESOURCE_EVQPTR    0x5
-/* Address of register pointer (Falcon A) */
-#define EFX_VI_HW_RESOURCE_EVQRPTR   0x6
-/* Offset of register pointer (Falcon B) */
-#define EFX_VI_HW_RESOURCE_EVQRPTR_OFFSET 0x7
-/* Address of mem KVA */
-#define EFX_VI_HW_RESOURCE_EVQMEMKVA 0x8
-/* PFN of doorbell page (Falcon) */
-#define EFX_VI_HW_RESOURCE_BELLPAGE  0x9
-
-/*! How large an array to allocate for the get_() functions - smaller
-  than the total number of constants as some are mutually exclusive */
-#define EFX_VI_HW_RESOURCE_MAXSIZE   0x7
-
-/*! Constants for the mem_type field in efx_vi_hw_resource */
-#define EFX_VI_HW_RESOURCE_IOBUFFER   0        /* Host memory */
-#define EFX_VI_HW_RESOURCE_PERIPHERAL 1        /* Card memory/registers */
-
-/*!
- * Data structure providing information on a hardware resource mapping
- */
-struct efx_vi_hw_resource {
-       u8 type;                /*!< What this resource represents */
-       u8 mem_type;            /*!< What type of memory is it in, eg,
-                                * host or iomem */
-       u8 more_to_follow;      /*!< Is this part of a multi-region resource */
-       u32 length;             /*!< Length of the resource in bytes */
-       unsigned long address;  /*!< Address of this resource */
-};
-
-/*!
- * Metadata concerning the list of hardware resource mappings
- */
-struct efx_vi_hw_resource_metadata {
-       int evq_order;
-       int evq_offs;
-       int evq_capacity;
-       int instance;
-       unsigned rx_capacity;
-       unsigned tx_capacity;
-       int nic_arch;
-       int nic_revision;
-       char nic_variant;
-};
-
-/*!
- * Obtain a list of hardware resource mappings, using virtual addresses
- *
- * \param vih The handle to identify the efx_vi
- * \param mdata Pointer to a structure to receive the metadata
- * \param hw_res_array An array to receive the list of hardware resources
- * \param length The length of hw_res_array.  Updated on success to contain
- * the number of entries in the supplied array that were used.
- * \return Zero on success, non-zero on failure
- */
-extern int
-efx_vi_hw_resource_get_virt(struct efx_vi_state *vih,
-                           struct efx_vi_hw_resource_metadata *mdata,
-                           struct efx_vi_hw_resource *hw_res_array,
-                           int *length);
-
-/*!
- * Obtain a list of hardware resource mappings, using physical addresses
- *
- * \param vih The handle to identify the efx_vi
- * \param mdata Pointer to a structure to receive the metadata
- * \param hw_res_array An array to receive the list of hardware resources
- * \param length The length of hw_res_array.  Updated on success to contain
- * the number of entries in the supplied array that were used.
- * \return Zero on success, non-zero on failure
- */
-extern int
-efx_vi_hw_resource_get_phys(struct efx_vi_state *vih,
-                           struct efx_vi_hw_resource_metadata *mdata,
-                           struct efx_vi_hw_resource *hw_res_array,
-                           int *length);
-
-#endif /* __CI_DRIVER_RESOURCE_EFX_VI_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efhw/common.h
--- a/drivers/xen/sfc_netback/ci/efhw/common.h  Fri Jan 08 13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides API of the efhw library which may be used both from
- * the kernel and from the user-space code.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_COMMON_H__
-#define __CI_EFHW_COMMON_H__
-
-#include <ci/efhw/common_sysdep.h>
-
-enum efhw_arch {
-       EFHW_ARCH_FALCON,
-       EFHW_ARCH_SIENA,
-};
-
-typedef uint32_t efhw_buffer_addr_t;
-#define EFHW_BUFFER_ADDR_FMT   "[ba:%"PRIx32"]"
-
-/*! Comment? */
-typedef union {
-       uint64_t u64;
-       struct {
-               uint32_t a;
-               uint32_t b;
-       } opaque;
-} efhw_event_t;
-
-/* Flags for TX/RX queues */
-#define EFHW_VI_JUMBO_EN           0x01  /*! scatter RX over multiple desc */
-#define EFHW_VI_ISCSI_RX_HDIG_EN   0x02  /*! iscsi rx header digest */
-#define EFHW_VI_ISCSI_TX_HDIG_EN   0x04  /*! iscsi tx header digest */
-#define EFHW_VI_ISCSI_RX_DDIG_EN   0x08  /*! iscsi rx data digest */
-#define EFHW_VI_ISCSI_TX_DDIG_EN   0x10  /*! iscsi tx data digest */
-#define EFHW_VI_TX_PHYS_ADDR_EN    0x20  /*! TX physical address mode */
-#define EFHW_VI_RX_PHYS_ADDR_EN    0x40  /*! RX physical address mode */
-#define EFHW_VI_RM_WITH_INTERRUPT  0x80  /*! VI with an interrupt */
-#define EFHW_VI_TX_IP_CSUM_DIS     0x100 /*! enable ip checksum generation */
-#define EFHW_VI_TX_TCPUDP_CSUM_DIS 0x200 /*! enable tcp/udp checksum
-                                          generation */
-#define EFHW_VI_TX_TCPUDP_ONLY     0x400 /*! drop non-tcp/udp packets */
-
-/* Types of hardware filter */
-/* Each of these values implicitly selects scatter filters on B0 - or in
-   EFHW_IP_FILTER_TYPE_NOSCAT_B0_MASK if a non-scatter filter is required */
-#define EFHW_IP_FILTER_TYPE_UDP_WILDCARD  (0)  /* dest host only */
-#define EFHW_IP_FILTER_TYPE_UDP_FULL      (1)  /* dest host and port */
-#define EFHW_IP_FILTER_TYPE_TCP_WILDCARD  (2)  /* dest based filter */
-#define EFHW_IP_FILTER_TYPE_TCP_FULL      (3)  /* src  filter */
-/* Same again, but with RSS (for B0 only) */
-#define EFHW_IP_FILTER_TYPE_UDP_WILDCARD_RSS_B0  (4)
-#define EFHW_IP_FILTER_TYPE_UDP_FULL_RSS_B0      (5)
-#define EFHW_IP_FILTER_TYPE_TCP_WILDCARD_RSS_B0  (6)
-#define EFHW_IP_FILTER_TYPE_TCP_FULL_RSS_B0      (7)
-
-#define EFHW_IP_FILTER_TYPE_FULL_MASK      (0x1) /* Mask for full / wildcard */
-#define EFHW_IP_FILTER_TYPE_TCP_MASK       (0x2) /* Mask for TCP type */
-#define EFHW_IP_FILTER_TYPE_RSS_B0_MASK    (0x4) /* Mask for B0 RSS enable */
-#define EFHW_IP_FILTER_TYPE_NOSCAT_B0_MASK (0x8) /* Mask for B0 SCATTER dsbl */
-
-#define EFHW_IP_FILTER_TYPE_MASK       (0xffff) /* Mask of types above */
-
-#define EFHW_IP_FILTER_BROADCAST       (0x10000) /* driverlink filter
-                                                    support */
-
-#endif /* __CI_EFHW_COMMON_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efhw/common_sysdep.h
--- a/drivers/xen/sfc_netback/ci/efhw/common_sysdep.h   Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides version-independent Linux kernel API for
- * userland-to-kernel interfaces.
- * Only kernels >=2.6.9 are supported.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_COMMON_LINUX_H__
-#define __CI_EFHW_COMMON_LINUX_H__
-
-#include <linux/types.h>
-#include <linux/version.h>
-
-/* Dirty hack, but Linux kernel does not provide DMA_ADDR_T_FMT */
-#if BITS_PER_LONG == 64 || defined(CONFIG_HIGHMEM64G)
-#define DMA_ADDR_T_FMT "%llx"
-#else
-#define DMA_ADDR_T_FMT "%x"
-#endif
-
-/* Linux kernel also does not provide PRIx32... Sigh. */
-#define PRIx32 "x"
- 
-#ifdef __ia64__
-# define PRIx64 "lx"
-#else
-# define PRIx64 "llx"
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
-enum {
-       false = 0,
-       true = 1
-};
-
-typedef _Bool bool;
-#endif /* LINUX_VERSION_CODE < 2.6.19 */
-
-#endif /* __CI_EFHW_COMMON_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efhw/debug.h
--- a/drivers/xen/sfc_netback/ci/efhw/debug.h   Fri Jan 08 13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides debug-related API for efhw library using Linux kernel
- * primitives.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_DEBUG_LINUX_H__
-#define __CI_EFHW_DEBUG_LINUX_H__
-
-#define EFHW_PRINTK_PREFIX "[sfc efhw] "
-
-#define EFHW_PRINTK(level, fmt, ...) \
-       printk(level EFHW_PRINTK_PREFIX fmt "\n", __VA_ARGS__)
-
-/* Following macros should be used with non-zero format parameters
- * due to __VA_ARGS__ limitations.  Use "%s" with __FUNCTION__ if you can't
- * find better parameters. */
-#define EFHW_ERR(fmt, ...)     EFHW_PRINTK(KERN_ERR, fmt, __VA_ARGS__)
-#define EFHW_WARN(fmt, ...)    EFHW_PRINTK(KERN_WARNING, fmt, __VA_ARGS__)
-#define EFHW_NOTICE(fmt, ...)  EFHW_PRINTK(KERN_NOTICE, fmt, __VA_ARGS__)
-#if 0 && !defined(NDEBUG)
-#define EFHW_TRACE(fmt, ...) EFHW_PRINTK(KERN_DEBUG, fmt, __VA_ARGS__)
-#else
-#define EFHW_TRACE(fmt, ...)
-#endif
-
-#ifndef NDEBUG
-#define EFHW_ASSERT(cond)  BUG_ON((cond) == 0)
-#define EFHW_DO_DEBUG(expr) expr
-#else
-#define EFHW_ASSERT(cond)
-#define EFHW_DO_DEBUG(expr)
-#endif
-
-#define EFHW_TEST(expr)                        \
-       do {                            \
-               if (unlikely(!(expr)))  \
-               BUG();                  \
-       } while (0)
-
-/* Build time asserts. We paste the line number into the type name
- * so that the macro can be used more than once per file even if the
- * compiler objects to multiple identical typedefs. Collisions
- * between use in different header files is still possible. */
-#ifndef EFHW_BUILD_ASSERT
-#define __EFHW_BUILD_ASSERT_NAME(_x) __EFHW_BUILD_ASSERT_ILOATHECPP(_x)
-#define __EFHW_BUILD_ASSERT_ILOATHECPP(_x)  __EFHW_BUILD_ASSERT__ ##_x
-#define EFHW_BUILD_ASSERT(e) \
-       typedef char __EFHW_BUILD_ASSERT_NAME(__LINE__)[(e) ? 1 : -1]
-#endif
-
-#endif /* __CI_EFHW_DEBUG_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efhw/efhw_config.h
--- a/drivers/xen/sfc_netback/ci/efhw/efhw_config.h     Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides some limits used in both kernel and userland code.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_EFAB_CONFIG_H__
-#define __CI_EFHW_EFAB_CONFIG_H__
-
-#define EFHW_MAX_NR_DEVS 5     /* max number of efhw devices supported */
-
-#endif /* __CI_EFHW_EFAB_CONFIG_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efhw/efhw_types.h
--- a/drivers/xen/sfc_netback/ci/efhw/efhw_types.h      Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides struct efhw_nic and some related types.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_EFAB_TYPES_H__
-#define __CI_EFHW_EFAB_TYPES_H__
-
-#include <ci/efhw/efhw_config.h>
-#include <ci/efhw/hardware_sysdep.h>
-#include <ci/efhw/iopage_types.h>
-#include <ci/efhw/sysdep.h>
-
-/*--------------------------------------------------------------------
- *
- * forward type declarations
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_nic;
-
-/*--------------------------------------------------------------------
- *
- * Managed interface
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_buffer_table_allocation{
-       unsigned base;
-       unsigned order;
-};
-
-struct eventq_resource_hardware {
-       /*!iobuffer allocated for eventq - can be larger than eventq */
-       struct efhw_iopages iobuff;
-       unsigned iobuff_off;
-       struct efhw_buffer_table_allocation buf_tbl_alloc;
-       int capacity;           /*!< capacity of event queue */
-};
-
-/*--------------------------------------------------------------------
- *
- * event queues and event driven callbacks
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_keventq {
-       int lock;
-       caddr_t evq_base;
-       int32_t evq_ptr;
-       uint32_t evq_mask;
-       unsigned instance;
-       struct eventq_resource_hardware hw;
-       struct efhw_ev_handler *ev_handlers;
-};
-
-/**********************************************************************
- * Portable HW interface. ***************************************
- **********************************************************************/
-
-/*--------------------------------------------------------------------
- *
- * EtherFabric Functional units - configuration and control
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_func_ops {
-
-  /*-------------- Initialisation ------------ */
-
-       /*! close down all hardware functional units - leaves NIC in a safe
-          state for driver unload */
-       void (*close_hardware) (struct efhw_nic *nic);
-
-       /*! initialise all hardware functional units */
-       int (*init_hardware) (struct efhw_nic *nic,
-                             struct efhw_ev_handler *,
-                             const uint8_t *mac_addr, int non_irq_evq);
-
-  /*-------------- Interrupt support  ------------ */
-
-       /*! Main interrupt routine
-        **        This function returns,
-        **  - zero,       if the IRQ was not generated by EF1
-        **  - non-zero,   if EF1 was the source of the IRQ
-        **
-        **
-        ** opaque is an OS provided pointer for use by the OS callbacks
-        ** e.g in Windows used to indicate DPC scheduled
-        */
-       int (*interrupt) (struct efhw_nic *nic);
-
-       /*! Enable the interrupt */
-       void (*interrupt_enable) (struct efhw_nic *nic);
-
-       /*! Disable the interrupt */
-       void (*interrupt_disable) (struct efhw_nic *nic);
-
-       /*! Set interrupt moderation strategy for the given IRQ unit
-        ** val is in usec
-        */
-       void (*set_interrupt_moderation)(struct efhw_nic *nic,
-                                        uint val);
-
-  /*-------------- Event support  ------------ */
-
-       /*! Enable the given event queue
-          depending on the underlying implementation (EF1 or Falcon) then
-          either a q_base_addr in host memory, or a buffer base id should
-          be proivded
-        */
-       void (*event_queue_enable) (struct efhw_nic *nic,
-                                   uint evq,   /* evnt queue index */
-                                   uint evq_size,      /* units of #entries */
-                                   dma_addr_t q_base_addr, uint buf_base_id);
-
-       /*! Disable the given event queue (and any associated timer) */
-       void (*event_queue_disable) (struct efhw_nic *nic, uint evq,
-                                    int timer_only);
-
-       /*! request wakeup from the NIC on a given event Q */
-       void (*wakeup_request) (struct efhw_nic *nic, dma_addr_t q_base_addr,
-                               int next_i, int evq);
-
-       /*! Push a SW event on a given eventQ */
-       void (*sw_event) (struct efhw_nic *nic, int data, int evq);
-
-  /*-------------- Filter support  ------------ */
-
-       /*! Setup a given filter - The software can request a filter_i,
-        * but some EtherFabric implementations will override with
-        * a more suitable index
-        */
-       int (*ipfilter_set) (struct efhw_nic *nic, int type,
-                            int *filter_i, int dmaq,
-                            unsigned saddr_be32, unsigned sport_be16,
-                            unsigned daddr_be32, unsigned dport_be16);
-
-       /*! Attach a given filter to a DMAQ */
-       void (*ipfilter_attach) (struct efhw_nic *nic, int filter_idx,
-                                int dmaq_idx);
-
-       /*! Detach a filter from its DMAQ */
-       void (*ipfilter_detach) (struct efhw_nic *nic, int filter_idx);
-
-       /*! Clear down a given filter */
-       void (*ipfilter_clear) (struct efhw_nic *nic, int filter_idx);
-
-  /*-------------- DMA support  ------------ */
-
-       /*! Initialise NIC state for a given TX DMAQ */
-       void (*dmaq_tx_q_init) (struct efhw_nic *nic,
-                               uint dmaq, uint evq, uint owner, uint tag,
-                               uint dmaq_size, uint buf_idx, uint flags);
-
-       /*! Initialise NIC state for a given RX DMAQ */
-       void (*dmaq_rx_q_init) (struct efhw_nic *nic,
-                               uint dmaq, uint evq, uint owner, uint tag,
-                               uint dmaq_size, uint buf_idx, uint flags);
-
-       /*! Disable a given TX DMAQ */
-       void (*dmaq_tx_q_disable) (struct efhw_nic *nic, uint dmaq);
-
-       /*! Disable a given RX DMAQ */
-       void (*dmaq_rx_q_disable) (struct efhw_nic *nic, uint dmaq);
-
-       /*! Flush a given TX DMA channel */
-       int (*flush_tx_dma_channel) (struct efhw_nic *nic, uint dmaq);
-
-       /*! Flush a given RX DMA channel */
-       int (*flush_rx_dma_channel) (struct efhw_nic *nic, uint dmaq);
-
-  /*-------------- Buffer table Support ------------ */
-
-       /*! Initialise a buffer table page */
-       void (*buffer_table_set) (struct efhw_nic *nic,
-                                 dma_addr_t dma_addr,
-                                 uint bufsz, uint region,
-                                 int own_id, int buffer_id);
-
-       /*! Initialise a block of buffer table pages */
-       void (*buffer_table_set_n) (struct efhw_nic *nic, int buffer_id,
-                                   dma_addr_t dma_addr,
-                                   uint bufsz, uint region,
-                                   int n_pages, int own_id);
-
-       /*! Clear a block of buffer table pages */
-       void (*buffer_table_clear) (struct efhw_nic *nic, int buffer_id,
-                                   int num);
-
-       /*! Commit a buffer table update  */
-       void (*buffer_table_commit) (struct efhw_nic *nic);
-
-};
-
-
-/*----------------------------------------------------------------------------
- *
- * NIC type
- *
- *---------------------------------------------------------------------------*/
-
-struct efhw_device_type {
-       int  arch;            /* enum efhw_arch */
-       char variant;         /* 'A', 'B', ... */
-       int  revision;        /* 0, 1, ... */
-};
-
-
-/*----------------------------------------------------------------------------
- *
- * EtherFabric NIC instance - nic.c for HW independent functions
- *
- *---------------------------------------------------------------------------*/
-
-/*! */
-struct efhw_nic {
-       /*! zero base index in efrm_nic_tablep->nic array */
-       int index;
-       int ifindex;            /*!< OS level nic index */
-#ifdef HAS_NET_NAMESPACE
-       struct net *nd_net;
-#endif
-
-       struct efhw_device_type devtype;
-
-       /*! Options that can be set by user. */
-       unsigned options;
-# define NIC_OPT_EFTEST             0x1        /* owner is an eftest app */
-
-# define NIC_OPT_DEFAULT            0
-
-       /*! Internal flags that indicate hardware properties at runtime. */
-       unsigned flags;
-# define NIC_FLAG_NO_INTERRUPT          0x01 /* to be set at init time only */
-# define NIC_FLAG_TRY_MSI               0x02
-# define NIC_FLAG_MSI                   0x04
-# define NIC_FLAG_OS_IRQ_EN             0x08
-# define NIC_FLAG_10G                   0x10
-
-       unsigned mtu;           /*!< MAC MTU (includes MAC hdr) */
-
-       /* hardware resources */
-
-       /*! I/O address of the start of the bar */
-       volatile char __iomem *bar_ioaddr;
-
-       /*! Bar number of control aperture. */
-       unsigned ctr_ap_bar;
-       /*! Length of control aperture in bytes. */
-       unsigned ctr_ap_bytes;
-
-       uint8_t mac_addr[ETH_ALEN];     /*!< mac address  */
-
-       /*! EtherFabric Functional Units -- functions */
-       const struct efhw_func_ops *efhw_func;
-
-       /* Value read from FPGA version register.  Zero for asic. */
-       unsigned fpga_version;
-
-       /*! This lock protects a number of misc NIC resources.  It should
-        * only be used for things that can be at the bottom of the lock
-        * order.  ie. You mustn't attempt to grab any other lock while
-        * holding this one.
-        */
-       spinlock_t *reg_lock;
-       spinlock_t the_reg_lock;
-
-       int buf_commit_outstanding;     /*!< outstanding buffer commits */
-
-       /*! interrupt callbacks (hard-irq) */
-       void (*irq_handler) (struct efhw_nic *, int unit);
-
-       /*! event queues per driver */
-       struct efhw_keventq interrupting_evq;
-
-/* for marking when we are not using an IRQ unit
-      - 0 is a valid offset to an IRQ unit on EF1! */
-#define EFHW_IRQ_UNIT_UNUSED  0xffff
-       /*! interrupt unit in use for the interrupting event queue  */
-       unsigned int irq_unit;
-
-       struct efhw_keventq non_interrupting_evq;
-
-       struct efhw_iopage irq_iobuff;  /*!<  Falcon SYSERR interrupt */
-
-       /* The new driverlink infrastructure. */
-       struct efx_dl_device *net_driver_dev;
-       struct efx_dlfilt_cb_s *dlfilter_cb;
-
-       /*! Bit masks of the sizes of event queues and dma queues supported
-        * by the nic. */
-       unsigned evq_sizes;
-       unsigned rxq_sizes;
-       unsigned txq_sizes;
-
-       /* Size of filter table (including odd and even banks). */
-       unsigned filter_tbl_size;
-};
-
-
-#define EFHW_KVA(nic)       ((nic)->bar_ioaddr)
-
-
-#endif /* __CI_EFHW_EFHW_TYPES_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efhw/hardware_sysdep.h
--- a/drivers/xen/sfc_netback/ci/efhw/hardware_sysdep.h Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides version-independent Linux kernel API for header files
- * with hardware-related definitions (in ci/driver/efab/hardware*).
- * Only kernels >=2.6.9 are supported.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_HARDWARE_LINUX_H__
-#define __CI_EFHW_HARDWARE_LINUX_H__
-
-#include <asm/io.h>
-
-#ifdef __LITTLE_ENDIAN
-#define EFHW_IS_LITTLE_ENDIAN
-#elif __BIG_ENDIAN
-#define EFHW_IS_BIG_ENDIAN
-#else
-#error Unknown endianness
-#endif
-
-#ifndef __iomem
-#define __iomem
-#endif
-
-#ifndef mmiowb
-       #if defined(__i386__) || defined(__x86_64__)
-               #define mmiowb()
-       #elif defined(__ia64__)
-               #ifndef ia64_mfa
-                       #define ia64_mfa() asm volatile ("mf.a" ::: "memory")
-               #endif
-       #define mmiowb ia64_mfa
-       #else
-       #error "Need definition for mmiowb()"
-       #endif
-#endif
-
-#ifndef readq
-static inline uint64_t __readq(volatile void __iomem *addr)
-{
-       return *(volatile uint64_t *)addr;
-}
-#define readq(x) __readq(x)
-#endif
-
-#ifndef writeq
-static inline void __writeq(uint64_t v, volatile void __iomem *addr)
-{
-       *(volatile uint64_t *)addr = v;
-}
-#define writeq(val, addr) __writeq((val), (addr))
-#endif
-
-#endif /* __CI_EFHW_HARDWARE_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efhw/iopage_types.h
--- a/drivers/xen/sfc_netback/ci/efhw/iopage_types.h    Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides struct efhw_page and struct efhw_iopage for Linux
- * kernel.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_IOPAGE_LINUX_H__
-#define __CI_EFHW_IOPAGE_LINUX_H__
-
-#include <linux/version.h>
-#include <linux/gfp.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-#include <linux/hardirq.h>
-#else
-#include <asm/hardirq.h>
-#endif
-#include <linux/errno.h>
-#include <ci/efhw/debug.h>
-
-/*--------------------------------------------------------------------
- *
- * struct efhw_page: A single page of memory.  Directly mapped in the
- * driver, and can be mapped to userlevel.
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_page {
-       unsigned long kva;
-};
-
-static inline int efhw_page_alloc(struct efhw_page *p)
-{
-       p->kva = __get_free_page(in_interrupt()? GFP_ATOMIC : GFP_KERNEL);
-       return p->kva ? 0 : -ENOMEM;
-}
-
-static inline int efhw_page_alloc_zeroed(struct efhw_page *p)
-{
-       p->kva = get_zeroed_page(in_interrupt()? GFP_ATOMIC : GFP_KERNEL);
-       return p->kva ? 0 : -ENOMEM;
-}
-
-static inline void efhw_page_free(struct efhw_page *p)
-{
-       free_page(p->kva);
-       EFHW_DO_DEBUG(memset(p, 0, sizeof(*p)));
-}
-
-static inline char *efhw_page_ptr(struct efhw_page *p)
-{
-       return (char *)p->kva;
-}
-
-static inline unsigned efhw_page_pfn(struct efhw_page *p)
-{
-       return (unsigned)(__pa(p->kva) >> PAGE_SHIFT);
-}
-
-static inline void efhw_page_mark_invalid(struct efhw_page *p)
-{
-       p->kva = 0;
-}
-
-static inline int efhw_page_is_valid(struct efhw_page *p)
-{
-       return p->kva != 0;
-}
-
-static inline void efhw_page_init_from_va(struct efhw_page *p, void *va)
-{
-       p->kva = (unsigned long)va;
-}
-
-/*--------------------------------------------------------------------
- *
- * struct efhw_iopage: A single page of memory.  Directly mapped in the driver,
- * and can be mapped to userlevel.  Can also be accessed by the NIC.
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_iopage {
-       struct efhw_page p;
-       dma_addr_t dma_addr;
-};
-
-static inline dma_addr_t efhw_iopage_dma_addr(struct efhw_iopage *p)
-{
-       return p->dma_addr;
-}
-
-#define efhw_iopage_ptr(iop)           efhw_page_ptr(&(iop)->p)
-#define efhw_iopage_pfn(iop)           efhw_page_pfn(&(iop)->p)
-#define efhw_iopage_mark_invalid(iop)  efhw_page_mark_invalid(&(iop)->p)
-#define efhw_iopage_is_valid(iop)      efhw_page_is_valid(&(iop)->p)
-
-/*--------------------------------------------------------------------
- *
- * struct efhw_iopages: A set of pages that are contiguous in physical
- * memory.  Directly mapped in the driver, and can be mapped to userlevel.
- * Can also be accessed by the NIC.
- *
- * NB. The O/S may be unwilling to allocate many, or even any of these.  So
- * only use this type where the NIC really needs a physically contiguous
- * buffer.
- *
- *--------------------------------------------------------------------*/
-
-struct efhw_iopages {
-       caddr_t kva;
-       unsigned order;
-       dma_addr_t dma_addr;
-};
-
-static inline caddr_t efhw_iopages_ptr(struct efhw_iopages *p)
-{
-       return p->kva;
-}
-
-static inline unsigned efhw_iopages_pfn(struct efhw_iopages *p)
-{
-       return (unsigned)(__pa(p->kva) >> PAGE_SHIFT);
-}
-
-static inline dma_addr_t efhw_iopages_dma_addr(struct efhw_iopages *p)
-{
-       return p->dma_addr;
-}
-
-static inline unsigned efhw_iopages_size(struct efhw_iopages *p)
-{
-       return 1u << (p->order + PAGE_SHIFT);
-}
-
-/* struct efhw_iopage <-> struct efhw_iopages conversions for handling
- * physically contiguous allocations in iobufsets for iSCSI.  This allows
- * the essential information about contiguous allocations from
- * efhw_iopages_alloc() to be saved away in the struct efhw_iopage array in
- * an iobufset.  (Changing the iobufset resource to use a union type would
- * involve a lot of code changes, and make the iobufset's metadata larger
- * which could be bad as it's supposed to fit into a single page on some
- * platforms.)
- */
-static inline void
-efhw_iopage_init_from_iopages(struct efhw_iopage *iopage,
-                             struct efhw_iopages *iopages, unsigned pageno)
-{
-       iopage->p.kva = ((unsigned long)efhw_iopages_ptr(iopages))
-           + (pageno * PAGE_SIZE);
-       iopage->dma_addr = efhw_iopages_dma_addr(iopages) +
-           (pageno * PAGE_SIZE);
-}
-
-static inline void
-efhw_iopages_init_from_iopage(struct efhw_iopages *iopages,
-                             struct efhw_iopage *iopage, unsigned order)
-{
-       iopages->kva = (caddr_t) efhw_iopage_ptr(iopage);
-       EFHW_ASSERT(iopages->kva);
-       iopages->order = order;
-       iopages->dma_addr = efhw_iopage_dma_addr(iopage);
-}
-
-#endif /* __CI_EFHW_IOPAGE_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efhw/public.h
--- a/drivers/xen/sfc_netback/ci/efhw/public.h  Fri Jan 08 13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides public API of efhw library exported from the SFC
- * resource driver.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_PUBLIC_H__
-#define __CI_EFHW_PUBLIC_H__
-
-#include <ci/efhw/common.h>
-#include <ci/efhw/efhw_types.h>
-
-/*! Returns true if we have some EtherFabric functional units -
-  whether configured or not */
-static inline int efhw_nic_have_functional_units(struct efhw_nic *nic)
-{
-       return nic->efhw_func != 0;
-}
-
-/*! Returns true if the EtherFabric functional units have been configured  */
-static inline int efhw_nic_have_hw(struct efhw_nic *nic)
-{
-       return efhw_nic_have_functional_units(nic) && (EFHW_KVA(nic) != 0);
-}
-
-/*! Helper function to allocate the iobuffer needed by an eventq
- *   - it ensures the eventq has the correct alignment for the NIC
- *
- * \param rm        Event-queue resource manager
- * \param instance  Event-queue instance (index)
- * \param buf_bytes Requested size of eventq
- * \return          < 0 if iobuffer allocation fails
- */
-int efhw_nic_event_queue_alloc_iobuffer(struct efhw_nic *nic,
-                                       struct eventq_resource_hardware *h,
-                                       int evq_instance, unsigned buf_bytes);
-
-extern void falcon_nic_set_rx_usr_buf_size(struct efhw_nic *,
-                                          int rx_usr_buf_size);
-
-extern void
-falcon_nic_rx_filter_ctl_set(struct efhw_nic *nic, uint32_t tcp_full,
-                            uint32_t tcp_wild,
-                            uint32_t udp_full, uint32_t udp_wild);
-
-extern void
-falcon_nic_rx_filter_ctl_get(struct efhw_nic *nic, uint32_t *tcp_full,
-                            uint32_t *tcp_wild,
-                            uint32_t *udp_full, uint32_t *udp_wild);
-
-#endif /* __CI_EFHW_PUBLIC_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efhw/sysdep.h
--- a/drivers/xen/sfc_netback/ci/efhw/sysdep.h  Fri Jan 08 13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides version-independent Linux kernel API for efhw library.
- * Only kernels >=2.6.9 are supported.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFHW_SYSDEP_LINUX_H__
-#define __CI_EFHW_SYSDEP_LINUX_H__
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <linux/delay.h>
-#include <linux/if_ether.h>
-
-#include <linux/netdevice.h> /* necessary for etherdevice.h on some kernels */
-#include <linux/etherdevice.h>
-
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
-static inline int is_local_ether_addr(const u8 *addr)
-{
-       return (0x02 & addr[0]);
-}
-#endif
-
-typedef unsigned long irq_flags_t;
-
-#define spin_lock_destroy(l_)  do {} while (0)
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
-#define HAS_NET_NAMESPACE
-#endif
-
-/* Funny, but linux has round_up for x86 only, defined in
- * x86-specific header */
-#ifndef round_up
-#define round_up(x, y) (((x) + (y) - 1) & ~((y)-1))
-#endif
-
-#endif /* __CI_EFHW_SYSDEP_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efrm/nic_table.h
--- a/drivers/xen/sfc_netback/ci/efrm/nic_table.h       Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides public API for NIC table.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFRM_NIC_TABLE_H__
-#define __CI_EFRM_NIC_TABLE_H__
-
-#include <ci/efhw/efhw_types.h>
-#include <ci/efrm/sysdep.h>
-
-/*--------------------------------------------------------------------
- *
- * struct efrm_nic_table - top level driver object keeping all NICs -
- * implemented in driver_object.c
- *
- *--------------------------------------------------------------------*/
-
-/*! Comment? */
-struct efrm_nic_table {
-       /*! nics attached to this driver */
-       struct efhw_nic *nic[EFHW_MAX_NR_DEVS];
-       /*! pointer to an arbitrary struct efhw_nic if one exists;
-        * for code which does not care which NIC it wants but
-        * still needs one. Note you cannot assume nic[0] exists. */
-       struct efhw_nic *a_nic;
-       uint32_t nic_count;     /*!< number of nics attached to this driver */
-       spinlock_t lock;        /*!< lock for table modifications */
-       atomic_t ref_count;     /*!< refcount for users of nic table */
-};
-
-/* Resource driver structures used by other drivers as well */
-extern struct efrm_nic_table *efrm_nic_tablep;
-
-static inline void efrm_nic_table_hold(void)
-{
-       atomic_inc(&efrm_nic_tablep->ref_count);
-}
-
-static inline void efrm_nic_table_rele(void)
-{
-       atomic_dec(&efrm_nic_tablep->ref_count);
-}
-
-static inline int efrm_nic_table_held(void)
-{
-       return (atomic_read(&efrm_nic_tablep->ref_count) != 0);
-}
-
-/* Run code block _x multiple times with variable nic set to each
- * registered NIC in turn.
- * DO NOT "break" out of this loop early. */
-#define EFRM_FOR_EACH_NIC(_nic_i, _nic)                                        
\
-       for ((_nic_i) = (efrm_nic_table_hold(), 0);                     \
-            (_nic_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0); \
-            (_nic_i)++)                                                \
-               if (((_nic) = efrm_nic_tablep->nic[_nic_i]))
-
-#define EFRM_FOR_EACH_NIC_IN_SET(_set, _i, _nic)                       \
-       for ((_i) = (efrm_nic_table_hold(), 0);                         \
-            (_i) < EFHW_MAX_NR_DEVS || (efrm_nic_table_rele(), 0);     \
-            ++(_i))                                                    \
-               if (((_nic) = efrm_nic_tablep->nic[_i]) &&              \
-                   efrm_nic_set_read((_set), (_i)))
-
-#endif /* __CI_EFRM_NIC_TABLE_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netback/ci/efrm/sysdep.h
--- a/drivers/xen/sfc_netback/ci/efrm/sysdep.h  Fri Jan 08 13:06:22 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides Linux-like system-independent API for efrm library.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFRM_SYSDEP_H__
-#define __CI_EFRM_SYSDEP_H__
-
-/* Spinlocks are defined in efhw/sysdep.h */
-#include <ci/efhw/sysdep.h>
-
-#if defined(__linux__) && defined(__KERNEL__)
-
-# include <ci/efrm/sysdep_linux.h>
-
-#else
-
-# include <ci/efrm/sysdep_ci2linux.h>
-
-#endif
-
-#endif /* __CI_EFRM_SYSDEP_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 
drivers/xen/sfc_netback/ci/efrm/sysdep_linux.h
--- a/drivers/xen/sfc_netback/ci/efrm/sysdep_linux.h    Fri Jan 08 13:06:22 
2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare network controllers -
- *          resource management for Xen backend, OpenOnload, etc
- *           (including support for SFE4001 10GBT NIC)
- *
- * This file provides version-independent Linux kernel API for efrm library.
- * Only kernels >=2.6.9 are supported.
- *
- * Copyright 2005-2007: Solarflare Communications Inc,
- *                      9501 Jeronimo Road, Suite 250,
- *                      Irvine, CA 92618, USA
- *
- * Kfifo API is partially stolen from linux-2.6.22/include/linux/list.h
- * Copyright (C) 2004 Stelian Pop <stelian@xxxxxxxxxx>
- *
- * Developed and maintained by Solarflare Communications:
- *                      <linux-xen-drivers@xxxxxxxxxxxxxx>
- *                      <onload-dev@xxxxxxxxxxxxxx>
- *
- * Certain parts of the driver were implemented by
- *          Alexandra Kossovsky <Alexandra.Kossovsky@xxxxxxxxxxxx>
- *          OKTET Labs Ltd, Russia,
- *          http://oktetlabs.ru, <info@xxxxxxxxxxxx>
- *          by request of Solarflare Communications
- *
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************
- */
-
-#ifndef __CI_EFRM_SYSDEP_LINUX_H__
-#define __CI_EFRM_SYSDEP_LINUX_H__
-
-#include <linux/version.h>
-#include <linux/list.h>
-#include <linux/vmalloc.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/workqueue.h>
-#include <linux/gfp.h>
-#include <linux/slab.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-#include <linux/hardirq.h>
-#else
-#include <asm/hardirq.h>
-#endif
-#include <linux/kernel.h>
-#include <linux/if_ether.h>
-#include <linux/completion.h>
-#include <linux/in.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
-/* get roundup_pow_of_two(), which was in kernel.h in early kernel versions */
-#include <linux/log2.h>
-#endif
-
-
-/********************************************************************
- *
- * Utility functions
- *
- ********************************************************************/
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
-static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned 
long x)
-{
-        return (1UL << fls(x - 1));
-}
-#endif
-
-
-/********************************************************************
- *
- * List API
- *
- ********************************************************************/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
-static inline void
-list_replace_init(struct list_head *old, struct list_head *new)
-{
-       new->next = old->next;
-       new->next->prev = new;
-       new->prev = old->prev;
-       new->prev->next = new;
-       INIT_LIST_HEAD(old);
-}
-#endif
-
-static inline struct list_head *list_pop(struct list_head *list)
-{
-       struct list_head *link = list->next;
-       list_del(link);
-       return link;
-}
-
-static inline struct list_head *list_pop_tail(struct list_head *list)
-{
-       struct list_head *link = list->prev;
-       list_del(link);
-       return link;
-}
-
-/********************************************************************
- *
- * Workqueue API
- *
- ********************************************************************/
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-#define NEED_OLD_WORK_API
-
-/**
- * The old and new work function prototypes just change
- * the type of the pointer in the only argument, so it's
- * safe to cast one function type to the other
- */
-typedef void (*efrm_old_work_func_t) (void *p);
-
-#undef INIT_WORK
-#define INIT_WORK(_work, _func)                                        \
-       do {                                                    \
-               INIT_LIST_HEAD(&(_work)->entry);                \
-               (_work)->pending = 0;                           \
-               PREPARE_WORK((_work),                           \
-                            (efrm_old_work_func_t) (_func),    \
-                            (_work));                          \
-       } while (0)
-
-#endif
-
-/********************************************************************
- *
- * Kfifo API
- *
- ********************************************************************/
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-
-#if !defined(RHEL_RELEASE_CODE) || (RHEL_RELEASE_CODE < 1029)
-typedef unsigned gfp_t;
-#endif
-
-#define HAS_NO_KFIFO
-
-struct kfifo {
-       unsigned char *buffer;  /* the buffer holding the data */
-       unsigned int size;      /* the size of the allocated buffer */
-       unsigned int in;        /* data is added at offset (in % size) */
-       unsigned int out;       /* data is extracted from off. (out % size) */
-       spinlock_t *lock;       /* protects concurrent modifications */
-};
-
-extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
-                               gfp_t gfp_mask, spinlock_t *lock);
-extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
-                                spinlock_t *lock);
-extern void kfifo_free(struct kfifo *fifo);
-extern unsigned int __kfifo_put(struct kfifo *fifo,
-                               unsigned char *buffer, unsigned int len);
-extern unsigned int __kfifo_get(struct kfifo *fifo,
-                               unsigned char *buffer, unsigned int len);
-
-/**
- * kfifo_put - puts some data into the FIFO
- * @fifo: the fifo to be used.
- * @buffer: the data to be added.
- * @len: the length of the data to be added.
- *
- * This function copies at most @len bytes from the @buffer into
- * the FIFO depending on the free space, and returns the number of
- * bytes copied.
- */
-static inline unsigned int
-kfifo_put(struct kfifo *fifo, unsigned char *buffer, unsigned int len)
-{
-       unsigned long flags;
-       unsigned int ret;
-
-       spin_lock_irqsave(fifo->lock, flags);
-
-       ret = __kfifo_put(fifo, buffer, len);
-
-       spin_unlock_irqrestore(fifo->lock, flags);
-
-       return ret;
-}
-
-/**
- * kfifo_get - gets some data from the FIFO
- * @fifo: the fifo to be used.
- * @buffer: where the data must be copied.
- * @len: the size of the destination buffer.
- *
- * This function copies at most @len bytes from the FIFO into the
- * @buffer and returns the number of copied bytes.
- */
-static inline unsigned int
-kfifo_get(struct kfifo *fifo, unsigned char *buffer, unsigned int len)
-{
-       unsigned long flags;
-       unsigned int ret;
-
-       spin_lock_irqsave(fifo->lock, flags);
-
-       ret = __kfifo_get(fifo, buffer, len);
-
-       /*
-        * optimization: if the FIFO is empty, set the indices to 0
-        * so we don't wrap the next time
-        */
-       if (fifo->in == fifo->out)
-               fifo->in = fifo->out = 0;
-
-       spin_unlock_irqrestore(fifo->lock, flags);
-
-       return ret;
-}
-
-/**
- * __kfifo_len - returns the number of bytes available in the FIFO, no locking 
version
- * @fifo: the fifo to be used.
- */
-static inline unsigned int __kfifo_len(struct kfifo *fifo)
-{
-       return fifo->in - fifo->out;
-}
-
-/**
- * kfifo_len - returns the number of bytes available in the FIFO
- * @fifo: the fifo to be used.
- */
-static inline unsigned int kfifo_len(struct kfifo *fifo)
-{
-       unsigned long flags;
-       unsigned int ret;
-
-       spin_lock_irqsave(fifo->lock, flags);
-
-       ret = __kfifo_len(fifo);
-
-       spin_unlock_irqrestore(fifo->lock, flags);
-
-       return ret;
-}
-
-#else
-#include <linux/kfifo.h>
-#endif
-
-static inline void kfifo_vfree(struct kfifo *fifo)
-{
-       vfree(fifo->buffer);
-       kfree(fifo);
-}
-
-#endif /* __CI_EFRM_SYSDEP_LINUX_H__ */
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netfront/accel_vi.c
--- a/drivers/xen/sfc_netfront/accel_vi.c       Fri Jan 08 13:06:22 2010 +0000
+++ b/drivers/xen/sfc_netfront/accel_vi.c       Fri Jan 08 13:07:17 2010 +0000
@@ -89,6 +89,7 @@ int netfront_accel_vi_init_fini(netfront
                        (hw_info->evq_rptr & (PAGE_SIZE - 1));
                break;
        case NET_ACCEL_MSG_HWTYPE_FALCON_B:
+       case NET_ACCEL_MSG_HWTYPE_SIENA_A:
                hw_info = &hw_msg->resources.falcon_b;
                break;
        default:
@@ -124,8 +125,9 @@ int netfront_accel_vi_init_fini(netfront
        }
        vnic->hw.falcon.doorbell = doorbell_kva;
 
-       /* On Falcon_B we get the rptr from the doorbell page */
-       if (hw_msg->type == NET_ACCEL_MSG_HWTYPE_FALCON_B) {
+       /* On Falcon_B and Siena we get the rptr from the doorbell page */
+       if (hw_msg->type == NET_ACCEL_MSG_HWTYPE_FALCON_B ||
+           hw_msg->type == NET_ACCEL_MSG_HWTYPE_SIENA_A) {
                vnic->hw.falcon.evq_rptr = 
                        (u32 *)((char *)vnic->hw.falcon.doorbell 
                                + hw_info->evq_rptr);
diff -r b8c2a9aacba6 -r 6061d5615522 drivers/xen/sfc_netutil/accel_msg_iface.h
--- a/drivers/xen/sfc_netutil/accel_msg_iface.h Fri Jan 08 13:06:22 2010 +0000
+++ b/drivers/xen/sfc_netutil/accel_msg_iface.h Fri Jan 08 13:07:17 2010 +0000
@@ -120,6 +120,7 @@ enum net_accel_hw_type {
        /*! NIC is Falcon-based */
        NET_ACCEL_MSG_HWTYPE_FALCON_A = 1,
        NET_ACCEL_MSG_HWTYPE_FALCON_B = 2,
+       NET_ACCEL_MSG_HWTYPE_SIENA_A = 3,
 };
 
 /*! The maximum number of pages used by an event queue. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.