From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kieran Mansley Subject: Re: [Patch 0/4] Accelerated network drivers Date: Wed, 20 Feb 2008 13:23:45 +0000 Message-ID: <1203513825.4255.24.camel@moonstone.uk.level5networks.com> References: <1203065272.14484.0.camel@moonstone.uk.level5networks.com> <1203329846.4092.20.camel@moonstone.uk.level5networks.com> <1203429658.7285.52.camel@bling> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-TGRP4aGrzNyLQRKrayE5" Return-path: In-Reply-To: <1203429658.7285.52.camel@bling> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Alex Williamson Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-TGRP4aGrzNyLQRKrayE5 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, 2008-02-19 at 07:00 -0700, Alex Williamson wrote: > On Mon, 2008-02-18 at 10:17 +0000, Kieran Mansley wrote: > > On Fri, 2008-02-15 at 08:47 +0000, Kieran Mansley wrote: > > > This patch set provides the standard net driver and accelerated network > > > driver plug-ins for Solarflare range of 10G network cards. The > > > accelerated network plug-ins make use of the modifications contributed > > > to netfront and netback last year. > > > > > > The four patches are as follows: > > > > > > Patch 1: standard Linux net driver (provides module "sfc") > > > Patch 2: resource manager driver (provides module "sfc_resource") > > > Patch 3: netfront plug-in module (provides module "sfc_netfront" and > > > "sfc_netutil") > > > Patch 4: netback plug-in module (provides module "sfc_netback") > > Hi Kieran, > > I attempted to build this on ia64 and ran into several issues: Apologies for the problems you've seen. You've clearly hit something of a sweet spot (or should that be sour-spot?) for compiling in ways I don't do as routinely as I should. I've attached a set of patches that should resolve all the problems you describe. Unfortunately until I can test more thoroughly on our IA64 hardware I've marked the acceleration modules as requiring CONFIG_X86, so this will prevent these modules from being used on IA64 systems for the time being. The patches are as follows: sfc_net_static_compile - fix the namespace clash problem from the module paramenters when compiling the plugins statically into the kernel. debugfs_create_u64 - move the debugfs_create_u64 which had duplicate implementations in each plugin into the standard Linux debugfs files. sfc_debugfs_off_compile - Fix compile error when not selecting CONFIG_SFC_DEBUGFS sfc_config_x86_dependency - Specify module "depends on" to more accurately describe what the real dependencies are. IA64_PRIx64 - fix the definition of PRIx64 in the sfc modules to be properly defined on IA64 architectures. Thanks Kieran --=-TGRP4aGrzNyLQRKrayE5 Content-Disposition: attachment; filename=debugfs_create_u64 Content-Type: text/x-patch; name=debugfs_create_u64; charset=utf-8 Content-Transfer-Encoding: 7bit diff -r 7693635f3e97 drivers/xen/sfc_netback/accel_debugfs.c --- a/drivers/xen/sfc_netback/accel_debugfs.c +++ b/drivers/xen/sfc_netback/accel_debugfs.c @@ -37,28 +37,6 @@ static struct netback_accel_global_dbfs static struct netback_accel_global_dbfs global_dbfs; #endif #endif - -/* - * Extend debugfs helper functions to have a u64 version - */ -static void debugfs_u64_set(void *data, u64 val) -{ - *(u64 *)data = val; -} - -static u64 debugfs_u64_get(void *data) -{ - return *(u64 *)data; -} - -DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n"); - -struct dentry *debugfs_create_u64(const char *name, mode_t mode, - struct dentry *parent, u64 *value) -{ - return debugfs_create_file(name, mode, parent, value, &fops_u64); -} - void netback_accel_debugfs_init(void) { diff -r 7693635f3e97 drivers/xen/sfc_netfront/accel_debugfs.c --- a/drivers/xen/sfc_netfront/accel_debugfs.c +++ b/drivers/xen/sfc_netfront/accel_debugfs.c @@ -30,29 +30,6 @@ #if defined(CONFIG_DEBUG_FS) static struct dentry *sfc_debugfs_root = NULL; #endif - - -/* - * Extend debugfs helper functions to have a u64 version - */ -static void debugfs_u64_set(void *data, u64 val) -{ - *(u64 *)data = val; -} - -static u64 debugfs_u64_get(void *data) -{ - return *(u64 *)data; -} - -DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n"); - -struct dentry *debugfs_create_u64(const char *name, mode_t mode, - struct dentry *parent, u64 *value) -{ - return debugfs_create_file(name, mode, parent, value, &fops_u64); -} - void netfront_accel_debugfs_init(void) { diff -r 7693635f3e97 fs/debugfs/file.c --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -170,6 +170,51 @@ struct dentry *debugfs_create_u32(const } EXPORT_SYMBOL_GPL(debugfs_create_u32); + +static void debugfs_u64_set(void *data, u64 val) +{ + *(u64 *)data = val; +} + +static u64 debugfs_u64_get(void *data) +{ + return *(u64 *)data; +} +DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n"); + +/** + * debugfs_create_u64 - create a file in the debugfs filesystem that is used to read and write an unsigned 64 bit value. + * + * @name: a pointer to a string containing the name of the file to create. + * @mode: the permission that the file should have + * @parent: a pointer to the parent dentry for this file. This should be a + * directory dentry if set. If this paramater is NULL, then the + * file will be created in the root of the debugfs filesystem. + * @value: a pointer to the variable that the file should read to and write + * from. + * + * This function creates a file in debugfs with the given name that + * contains the value of the variable @value. If the @mode variable is so + * set, it can be read from, and written to. + * + * This function will return a pointer to a dentry if it succeeds. This + * pointer must be passed to the debugfs_remove() function when the file is + * to be removed (no automatic cleanup happens if your module is unloaded, + * you are responsible here.) If an error occurs, NULL will be returned. + * + * If debugfs is not enabled in the kernel, the value -ENODEV will be + * returned. It is not wise to check for this value, but rather, check for + * NULL or !NULL instead as to eliminate the need for #ifdef in the calling + * code. + */ +struct dentry *debugfs_create_u64(const char *name, mode_t mode, + struct dentry *parent, u64 *value) +{ + return debugfs_create_file(name, mode, parent, value, &fops_u64); +} +EXPORT_SYMBOL_GPL(debugfs_create_u64); + + static ssize_t read_file_bool(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { diff -r 7693635f3e97 include/linux/debugfs.h --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -41,6 +41,8 @@ struct dentry *debugfs_create_u16(const struct dentry *parent, u16 *value); struct dentry *debugfs_create_u32(const char *name, mode_t mode, struct dentry *parent, u32 *value); +struct dentry *debugfs_create_u64(const char *name, mode_t mode, + struct dentry *parent, u64 *value); struct dentry *debugfs_create_bool(const char *name, mode_t mode, struct dentry *parent, u32 *value); @@ -94,6 +96,13 @@ static inline struct dentry *debugfs_cre return ERR_PTR(-ENODEV); } +static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, + struct dentry *parent, + u64 *value) +{ + return ERR_PTR(-ENODEV); +} + static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, struct dentry *parent, u32 *value) --=-TGRP4aGrzNyLQRKrayE5 Content-Disposition: attachment; filename=IA64_PRIx64 Content-Type: text/x-patch; name=IA64_PRIx64; charset=utf-8 Content-Transfer-Encoding: 7bit diff -r d70b5b49d7a7 drivers/net/sfc/sfc_resource/ci/efhw/common_sysdep.h --- a/drivers/net/sfc/sfc_resource/ci/efhw/common_sysdep.h +++ b/drivers/net/sfc/sfc_resource/ci/efhw/common_sysdep.h @@ -52,8 +52,12 @@ /* Linux kernel also does not provide PRIx32... Sigh. */ #define PRIx32 "x" -#define PRIx64 "llx" +#ifdef __ia64__ +# define PRIx64 "lx" +#else +# define PRIx64 "llx" +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) enum { --=-TGRP4aGrzNyLQRKrayE5 Content-Disposition: attachment; filename=sfc_config_x86_dependency Content-Type: text/x-patch; name=sfc_config_x86_dependency; charset=utf-8 Content-Transfer-Encoding: 7bit diff -r dcbff25269d2 drivers/net/sfc/Kconfig --- a/drivers/net/sfc/Kconfig +++ b/drivers/net/sfc/Kconfig @@ -28,7 +28,7 @@ config SFC_MTD new boot ROM to the NIC. config SFC_RESOURCE - depends on SFC + depends on SFC && X86 tristate "Solarflare Solarstorm SFC4000 resource driver" help This module provides the SFC resource manager driver. diff -r dcbff25269d2 drivers/xen/Kconfig --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -81,11 +81,12 @@ config XEN_NETDEV_PIPELINED_TRANSMITTER config XEN_NETDEV_ACCEL_SFC_UTIL tristate + depends on X86 default n config XEN_NETDEV_ACCEL_SFC_BACKEND tristate "Network-device backend driver acceleration for Solarflare NICs" - depends on XEN_NETDEV_BACKEND + depends on XEN_NETDEV_BACKEND && SFC && SFC_RESOURCE && X86 select XEN_NETDEV_ACCEL_SFC_UTIL default m @@ -194,7 +195,7 @@ config XEN_GRANT_DEV config XEN_NETDEV_ACCEL_SFC_FRONTEND tristate "Network-device frontend driver acceleration for Solarflare NICs" - depends on XEN_NETDEV_FRONTEND + depends on XEN_NETDEV_FRONTEND && X86 select XEN_NETDEV_ACCEL_SFC_UTIL default m --=-TGRP4aGrzNyLQRKrayE5 Content-Disposition: attachment; filename=sfc_debugfs_off_compile Content-Type: text/x-patch; name=sfc_debugfs_off_compile; charset=utf-8 Content-Transfer-Encoding: 7bit diff -r 480bb0e62d4c drivers/net/sfc/tenxpress.c --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c @@ -391,9 +391,11 @@ static int tenxpress_phy_init(struct efx if (rc < 0) goto fail; +#ifdef CONFIG_SFC_DEBUGFS rc = tenxpress_debugfs_init(efx); if (rc < 0) goto fail; +#endif schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ diff -r 480bb0e62d4c drivers/net/sfc/txc43128_phy.c --- a/drivers/net/sfc/txc43128_phy.c +++ b/drivers/net/sfc/txc43128_phy.c @@ -644,8 +644,8 @@ static void txc43128_phy_fini(struct efx * don't use LASI interrupts. Also update the BER counters and poll the lm87 */ static int txc43128_phy_check_hw(struct efx_nic *efx) { + struct txc43128_data *data = efx->phy_data; #ifdef CONFIG_SFC_DEBUGFS - struct txc43128_data *data = efx->phy_data; int phy = efx->mii.phy_id; int timer, count, i, mmd; #endif --=-TGRP4aGrzNyLQRKrayE5 Content-Disposition: attachment; filename=sfc_net_static_compile Content-Type: text/x-patch; name=sfc_net_static_compile; charset=utf-8 Content-Transfer-Encoding: 7bit diff -r b851951738f4 drivers/xen/sfc_netback/accel.c --- a/drivers/xen/sfc_netback/accel.c +++ b/drivers/xen/sfc_netback/accel.c @@ -71,8 +71,8 @@ static struct notifier_block netback_acc }; -unsigned max_pages = NETBACK_ACCEL_DEFAULT_MAX_BUF_PAGES; -module_param(max_pages, int, 0666); +unsigned sfc_netback_max_pages = NETBACK_ACCEL_DEFAULT_MAX_BUF_PAGES; +module_param_named(max_pages, sfc_netback_max_pages, uint, 0666); MODULE_PARM_DESC(max_pages, "The number of buffer pages to enforce on each guest"); diff -r b851951738f4 drivers/xen/sfc_netback/accel.h --- a/drivers/xen/sfc_netback/accel.h +++ b/drivers/xen/sfc_netback/accel.h @@ -49,7 +49,7 @@ #define NETBACK_ACCEL_DEFAULT_MAX_MCASTS (8) #define NETBACK_ACCEL_DEFAULT_MAX_BUF_PAGES (384) /* Variable to store module parameter for max_buf_pages */ -extern unsigned max_pages; +extern unsigned sfc_netback_max_pages; #define NETBACK_ACCEL_STATS 1 diff -r b851951738f4 drivers/xen/sfc_netback/accel_xenbus.c --- a/drivers/xen/sfc_netback/accel_xenbus.c +++ b/drivers/xen/sfc_netback/accel_xenbus.c @@ -113,7 +113,7 @@ void cfg_hw_quotas(struct xenbus_device */ DPRINTK("Failed to read quotas from xenbus, using defaults\n"); bend->quotas.max_filters = NETBACK_ACCEL_DEFAULT_MAX_FILTERS; - bend->quotas.max_buf_pages = max_pages; + bend->quotas.max_buf_pages = sfc_netback_max_pages; bend->quotas.max_mcasts = NETBACK_ACCEL_DEFAULT_MAX_MCASTS; } diff -r b851951738f4 drivers/xen/sfc_netfront/accel.h --- a/drivers/xen/sfc_netfront/accel.h +++ b/drivers/xen/sfc_netfront/accel.h @@ -336,8 +336,8 @@ typedef struct netfront_accel_vnic { /* Module parameters */ -extern unsigned max_pages; -extern unsigned buffer_split; +extern unsigned sfc_netfront_max_pages; +extern unsigned sfc_netfront_buffer_split; extern const char *frontend_name; extern struct netfront_accel_hooks accel_hooks; diff -r b851951738f4 drivers/xen/sfc_netfront/accel_bufs.c --- a/drivers/xen/sfc_netfront/accel_bufs.c +++ b/drivers/xen/sfc_netfront/accel_bufs.c @@ -72,12 +72,12 @@ int netfront_accel_alloc_buffer_mem(stru int n, rc; if ((rc = netfront_accel_alloc_buf_desc_blocks - (rx_manager, pages - (pages / buffer_split))) < 0) { + (rx_manager, pages - (pages / sfc_netfront_buffer_split))) < 0) { goto rx_fail; } if ((rc = netfront_accel_alloc_buf_desc_blocks - (tx_manager, pages / buffer_split)) < 0) { + (tx_manager, pages / sfc_netfront_buffer_split)) < 0) { goto tx_fail; } diff -r b851951738f4 drivers/xen/sfc_netfront/accel_msg.c --- a/drivers/xen/sfc_netfront/accel_msg.c +++ b/drivers/xen/sfc_netfront/accel_msg.c @@ -157,7 +157,7 @@ static int vnic_add_bufs(netfront_accel_ offset = msg->u.mapbufs.reqid; if (offset < vnic->bufpages.max_pages - - (vnic->bufpages.max_pages / buffer_split)) { + (vnic->bufpages.max_pages / sfc_netfront_buffer_split)) { bufinfo = vnic->rx_bufs; } else bufinfo = vnic->tx_bufs; @@ -286,7 +286,7 @@ static int vnic_process_hello_msg(netfro struct net_accel_msg *msg) { int err = 0; - unsigned pages = max_pages; + unsigned pages = sfc_netfront_max_pages; if (vnic_check_hello_version(msg->u.hello.version) < 0) { msg->id = NET_ACCEL_MSG_HELLO | NET_ACCEL_MSG_REPLY diff -r b851951738f4 drivers/xen/sfc_netfront/accel_netfront.c --- a/drivers/xen/sfc_netfront/accel_netfront.c +++ b/drivers/xen/sfc_netfront/accel_netfront.c @@ -234,13 +234,14 @@ struct netfront_accel_hooks accel_hooks }; -unsigned max_pages = NETFRONT_ACCEL_DEFAULT_BUF_PAGES; -module_param (max_pages, int, 0666); +unsigned sfc_netfront_max_pages = NETFRONT_ACCEL_DEFAULT_BUF_PAGES; +module_param_named (max_pages, sfc_netfront_max_pages, uint, 0666); MODULE_PARM_DESC(max_pages, "Number of buffer pages to request"); -unsigned buffer_split = 2; -module_param (buffer_split, int, 0666); -MODULE_PARM_DESC(buffer_split, "Fraction of buffers to use for TX, rest for RX"); +unsigned sfc_netfront_buffer_split = 2; +module_param_named (buffer_split, sfc_netfront_buffer_split, uint, 0666); +MODULE_PARM_DESC(buffer_split, + "Fraction of buffers to use for TX, rest for RX"); const char *frontend_name = "sfc_netfront"; --=-TGRP4aGrzNyLQRKrayE5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-TGRP4aGrzNyLQRKrayE5--