* Re: [PATCH] seastar - SeaStar Ethernet driver (review comments addressed)
From: Stephen Hemminger @ 2010-02-03 2:07 UTC (permalink / raw)
To: Joe Perches
Cc: Kevin Pedretti, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <1265162522.1945.148.camel@Joe-Laptop.home>
On Tue, 02 Feb 2010 18:02:01 -0800
Joe Perches <joe@perches.com> wrote:
> Presumably SeaStar doesn't support multicast either, so maybe:
> if (dest_low_mac & 0x01)
Why not:
if (is_multicast_ether_addr(ethdr->h_dest))
...
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver (review comments addressed)
From: Joe Perches @ 2010-02-03 2:02 UTC (permalink / raw)
To: Kevin Pedretti; +Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <1265159307.15726.4.camel@hawkeye.sandia.gov>
On Tue, 2010-02-02 at 18:08 -0700, Kevin Pedretti wrote:
> diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/main.c linux-2.6.32.7/drivers/net/seastar/main.c
> --- linux-2.6.32.7-vanilla/drivers/net/seastar/main.c 1969-12-31 17:00:00.000000000 -0700
> +++ linux-2.6.32.7/drivers/net/seastar/main.c 2010-02-02 17:52:31.000000000 -0700
[]
> +static struct pending *alloc_tx_pending(struct ss_priv *ssp)
> +{
> + struct pending *pending = ssp->tx_pending_free_list;
> + if (!pending)
> + return NULL;
> +
> + ssp->tx_pending_free_list = pending->next;
> + pending->next = 0;
kernel style doesn't like pointer assignments of 0.
NULL is preferred.
> + /* Squash broadcast packets, SeaStar doesn't support broadcast */
> + if (dest_lo_mac == 0xFF) {
> + dev_err(&ssp->pdev->dev, "squashing broadcast packet.");
> + return -1;
> + }
Presumably SeaStar doesn't support multicast either, so maybe:
if (dest_low_mac & 0x01)
^ permalink raw reply
* Re: [PATCH] hrtimer, softirq: Fix hrtimer->softirq trampoline
From: Wei Yongjun @ 2010-02-03 1:47 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Yury Polyanskiy, Herbert Xu, netdev@vger.kernel.org,
David S. Miller, polyanskiy, Thomas Gleixner, lkml
In-Reply-To: <1265120401.24455.306.camel@laptop>
Peter Zijlstra wrote:
> On Tue, 2010-02-02 at 08:51 -0500, Yury Polyanskiy wrote:
>
> The original email had more information:
>
>
>> {IN-HARDIRQ-W} state was registered at:
>> [<c04718dc>] __lock_acquire+0xa9c/0x1890
>> [<c047274f>] lock_acquire+0x7f/0xf0
>> [<c0762958>] _raw_spin_lock+0x38/0x50
>> [<c072b5ca>] xfrm_timer_handler+0x3a/0x260
>> [<c0447d9d>] __hrtimer_tasklet_trampoline+0xd/0x10
>> [<c04634ce>] hrtimer_run_queues+0x15e/0x2a0
>> [<c045146d>] run_local_timers+0xd/0x20
>> [<c04514b4>] update_process_times+0x34/0x70
>> [<c046ce8a>] tick_periodic+0x2a/0x80
>> [<c046cefe>] tick_handle_periodic+0x1e/0x90
>> [<c0768377>] smp_apic_timer_interrupt+0x57/0x8b
>> [<c076382f>] apic_timer_interrupt+0x2f/0x34
>> [<c0401d3b>] cpu_idle+0x4b/0x80
>> [<c074e0d7>] rest_init+0x67/0x70
>> [<c0956874>] start_kernel+0x30e/0x314
>> [<c095609e>] i386_start_kernel+0x9e/0xa5
>>
>
> Which indicates we were called from hardirq context, it appears that
> that hrtimer_is_hres_active() case is indeed faulty. Not sure if I made
> a mistake when I wrote that or if we changed hrtimer behaviour
> afterwards, but the hrtimer fallback is still from hardirq context.
>
> Which would seem to suggest the following patch:
>
> ---
> Subject: hrtimer, softirq: Fix hrtimer->softirq trampoline
>
> hrtimers callbacks are always done from hardirq context, either the
> jiffy tick interrupt or the hrtimer device interrupt.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
>
With this patch, the inconsistent lock state INFO is gone. Thanks.
Wei Yongjun
^ permalink raw reply
* [GIT]: Networking
From: David Miller @ 2010-02-03 1:41 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
Besides the usual trickle of wired and wireless driver fixes.
we have:
1) bond_open() doesn't return sane error return values, from Stephem
Hemminger.
2) Off-by-one and expectation masking netfilter fixes from
Patrick McHardy.
3) The connector's notification code was buggy, it's hard to fix
but since nobody uses it simply kill it off. Fix from Evgeniy Polyakov.
I anticipate two more bug fixes coming my way which we really should
get into 2.6.33-final:
1) netfilter conntrack namespace handling is bugged and this
kills KVM folks using libvirt, problem is fully diagnosed and
patch should be in the works as I type this
2) sky2 transmit DMA mapping bug causes IOMMU mapping exhaustion
and other nasties, fix posted I just want it to cook for
another day or two
Please pull, thanks a lot!
The following changes since commit ab658321f32770b903a4426e2a6fae0392757755:
Linus Torvalds (1):
Merge branch 'for-linus' of git://git.kernel.org/.../tiwai/sound-2.6
are available in the git repository at:
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
Ajit Khaparde (1):
be2net: Bug fix to support newer generation of BE ASIC
Alexander Duyck (1):
igbvf: fix issue w/ mapped_as_page being left set after unmap
Andrei Emeltchenko (2):
Bluetooth: Remove double free of SKB pointer in L2CAP
Bluetooth: Fix memory leak in L2CAP
Bastien Nocera (1):
Bluetooth: Use the control channel for raw HID reports
Ben Hutchings (2):
starfire: clean up properly if firmware loading fails
cdc_ether: Partially revert "usbnet: Set link down initially ..."
Choi, David (1):
drivers/net: ks8851_mll ethernet network driver
David S. Miller (4):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
be2net: Fix memset() arg ordering.
Merge branch 'master' of git://git.kernel.org/.../holtmann/bluetooth-2.6
Merge branch 'master' of git://git.kernel.org/.../kaber/nf-2.6
Evgeniy Polyakov (1):
connector: Delete buggy notification code.
Felix Fietkau (2):
ath9k: fix beacon slot/buffer leak
ath9k: fix eeprom INI values override for 2GHz-only cards
Johannes Berg (1):
iwlwifi: fix pointer signedness warning
John Fastabend (2):
ixgbe: set the correct DCB bit for pg tx settings
ixgbe: if ixgbe_copy_dcb_cfg is going to fail learn about it early
Mike Frysinger (1):
Bluetooth: Redo checks in IRQ handler for shared IRQ support
Patrick McHardy (2):
netfilter: nf_conntrack_sip: fix off-by-one in compact header parsing
netfilter: ctnetlink: fix expectation mask dump
Sathya Perla (1):
be2net: use eq-id to calculate cev-isr reg offset
Shan Wei (1):
ipv6: conntrack: Add member of user to nf_ct_frag6_queue structure
Vikram Kandukuri (1):
Bluetooth: Add DFU driver for Atheros Bluetooth chipset AR3011
Zhu Yi (1):
mac80211: fix NULL pointer dereference when ftrace is enabled
stephen hemminger (1):
bonding: bond_open error return value
drivers/bluetooth/Kconfig | 13 ++-
drivers/bluetooth/Makefile | 1 +
drivers/bluetooth/ath3k.c | 187 +++++++++++++++++++++++++++++++
drivers/bluetooth/bluecard_cs.c | 4 +-
drivers/bluetooth/bt3c_cs.c | 4 +-
drivers/bluetooth/btuart_cs.c | 4 +-
drivers/bluetooth/dtl1_cs.c | 4 +-
drivers/connector/connector.c | 175 -----------------------------
drivers/net/benet/be.h | 5 +
drivers/net/benet/be_cmds.h | 3 +-
drivers/net/benet/be_main.c | 27 ++++-
drivers/net/bonding/bond_main.c | 2 +-
drivers/net/igbvf/netdev.c | 1 +
drivers/net/ixgbe/ixgbe_dcb_nl.c | 16 +--
drivers/net/ks8851_mll.c | 4 +-
drivers/net/starfire.c | 5 +-
drivers/net/usb/cdc_ether.c | 2 +-
drivers/net/wireless/ath/ath9k/hw.c | 7 +-
drivers/net/wireless/ath/ath9k/main.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-sta.c | 4 +-
include/linux/connector.h | 32 ------
net/bluetooth/hidp/core.c | 70 ++++++------
net/bluetooth/l2cap.c | 14 +--
net/ipv6/netfilter/nf_conntrack_reasm.c | 1 +
net/mac80211/driver-trace.h | 2 +-
net/netfilter/nf_conntrack_netlink.c | 3 +-
net/netfilter/nf_conntrack_sip.c | 2 +-
27 files changed, 312 insertions(+), 282 deletions(-)
create mode 100644 drivers/bluetooth/ath3k.c
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver
From: David Miller @ 2010-02-03 1:41 UTC (permalink / raw)
To: ktpedre; +Cc: netdev, linux-kernel
In-Reply-To: <20100202.174045.135005544.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Tue, 02 Feb 2010 17:40:45 -0800 (PST)
> From: "Kevin Pedretti" <ktpedre@sandia.gov>
> Date: Tue, 2 Feb 2010 18:24:02 -0700
>
>> 2. May want to use alloc_netdev() -> Didn't do this. Would there be a
>> substantial advantage to doing this?
>
> I think you're going to end up having to make this change.
Ignore this, using alloc_etherdev() should be just fine.
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver
From: David Miller @ 2010-02-03 1:40 UTC (permalink / raw)
To: ktpedre; +Cc: netdev, linux-kernel
In-Reply-To: <1265160242.15726.20.camel@hawkeye.sandia.gov>
From: "Kevin Pedretti" <ktpedre@sandia.gov>
Date: Tue, 2 Feb 2010 18:24:02 -0700
> 4. Device only supports IPv4? -> Yes, that's correct. No IPv6 support.
> The driver squashes everything but IPv4 in eth2ss().
Not just IPV6, what about other ethernet protocols?
What about ARP? How does IPV4 work if you only accept ETH_P_IP? You
need to accept at least ETH_P_ARP for things to work.
> 2. May want to use alloc_netdev() -> Didn't do this. Would there be a
> substantial advantage to doing this?
I think you're going to end up having to make this change.
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver (review comments addressed)
From: Stephen Hemminger @ 2010-02-03 1:39 UTC (permalink / raw)
To: Kevin Pedretti; +Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <1265159307.15726.4.camel@hawkeye.sandia.gov>
On Tue, 2 Feb 2010 18:08:27 -0700
"Kevin Pedretti" <ktpedre@sandia.gov> wrote:
> +
> +/* Rounds up to the nearest quadbyte */
> +#define ROUNDUP4(val) ((val + (4-1)) & ~(4-1))
kernel.h has ALIGN(val, 4) which is same thing.
--
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver (review comments addressed)
From: Kevin Pedretti @ 2010-02-03 1:08 UTC (permalink / raw)
To: netdev@vger.kernel.org; +Cc: linux-kernel@vger.kernel.org
In-Reply-To: <20100202205845.GE5246@hawkeye.sandia.gov>
[PATCH] seastar - SeaStar Ethernet driver (review comments addressed)
The following patch introduces the seastar driver for the
SeaStar network interface in Cray XT3/XT4/XT5 systems. The
driver is called 'seastar'. This patch is against 2.6.32.7.
The driver uses a simple datagram interface exported by the
SeaStar network interface to encapsulate Ethernet frames
on the Cray XT high speed network. The driver has been tested
to function correctly and is in use on Cray XT4 development
systems at Sandia.
Signed-off-by: Kevin Pedretti <ktpedre@sandia.gov>
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/Kconfig linux-2.6.32.7/drivers/net/Kconfig
--- linux-2.6.32.7-vanilla/drivers/net/Kconfig 2010-02-02 09:10:55.000000000 -0700
+++ linux-2.6.32.7/drivers/net/Kconfig 2010-02-02 09:12:04.000000000 -0700
@@ -2760,6 +2760,17 @@ config QLGE
To compile this driver as a module, choose M here: the module
will be called qlge.
+config SEASTAR
+ tristate "Cray XT SeaStar Ethernet driver"
+ depends on PCI
+ depends on HT_IRQ
+ ---help---
+ This driver supports the Cray XT SeaStar network interface in
+ Ethernet mode.
+
+ To compile this driver as a module, choose M here. The module
+ will be called seastar.
+
source "drivers/net/sfc/Kconfig"
source "drivers/net/benet/Kconfig"
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/Makefile linux-2.6.32.7/drivers/net/Makefile
--- linux-2.6.32.7-vanilla/drivers/net/Makefile 2010-02-02 09:10:55.000000000 -0700
+++ linux-2.6.32.7/drivers/net/Makefile 2010-02-02 09:12:04.000000000 -0700
@@ -149,6 +149,7 @@ obj-$(CONFIG_XILINX_LL_TEMAC) += ll_tema
obj-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
obj-$(CONFIG_QLA3XXX) += qla3xxx.o
obj-$(CONFIG_QLGE) += qlge/
+obj-$(CONFIG_SEASTAR) += seastar/
obj-$(CONFIG_PPP) += ppp_generic.o
obj-$(CONFIG_PPP_ASYNC) += ppp_async.o
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/firmware.c linux-2.6.32.7/drivers/net/seastar/firmware.c
--- linux-2.6.32.7-vanilla/drivers/net/seastar/firmware.c 1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.32.7/drivers/net/seastar/firmware.c 2010-02-02 17:41:57.000000000 -0700
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ SeaStar NIC Linux Driver
+
+ Copyright 2009-2010 Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
+ retains certain rights in this software.
+
+ Copyright (c) 2009-2010 Cray Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+ Contact Information:
+ Kevin Pedretti <ktpedre@sandia.gov>
+ Sandia National Laboratories
+ P.O. Box 5800
+ Albuquerque, NM 87185-1319
+
+*******************************************************************************/
+
+#include <linux/netdevice.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include "firmware.h"
+#include "seastar.h"
+
+/* Maps a region of host memory into the SeaStar */
+static void seastar_map_host_region(struct ss_priv *ssp, const void *addr)
+{
+ /* Round addr to the nearest 128 MB */
+ unsigned long raw_paddr = __pa(addr);
+ unsigned long paddr = raw_paddr & ~((1 << 28) - 1);
+
+ htb_map[8] = 0x8000 | ((paddr >> 28) + 0);
+ htb_map[9] = 0x8000 | ((paddr >> 28) + 1);
+
+ ssp->host_region_phys = paddr;
+}
+
+/* Converts a kernel virtual address to a SeaStar address */
+static u32 virt_to_fw(struct ss_priv *ssp, void *addr)
+{
+ unsigned long saddr;
+
+ saddr = __pa(addr) - ssp->host_region_phys;
+ saddr &= (2 << 28) - 1;
+ saddr += (8 << 28);
+
+ return saddr;
+}
+
+/* Send a command to the Seastar */
+static u32 seastar_cmd(struct ss_priv *ssp,
+ const struct command *cmd,
+ int wait_for_result)
+{
+ struct mailbox *mbox = ssp->mailbox;
+ unsigned int next_write;
+ u32 tail, result;
+ unsigned long long timeout;
+
+ /* Copy the command into the mailbox */
+ mbox->commandq[ssp->mailbox_cached_write] = *cmd;
+ next_write = ssp->mailbox_cached_write + 1;
+ if (next_write == COMMAND_Q_LENGTH)
+ next_write = 0;
+
+ /* Wait until it is safe to advance the write pointer */
+ timeout = 60000000000ULL; /* Empirically ~60 sec. on 2 GHz Cray XT */
+ while (next_write == ssp->mailbox_cached_read) {
+ ssp->mailbox_cached_read = mbox->commandq_read;
+ if (--timeout == 0) {
+ dev_err(&ssp->pdev->dev,
+ "waited too long sending cmd to NIC\n");
+ return (u32) -1;
+ }
+ }
+
+ /* Advance the write pointer */
+ mbox->commandq_write = next_write;
+ ssp->mailbox_cached_write = next_write;
+
+ if (!wait_for_result)
+ return 0;
+
+ /* Wait for the result to arrive */
+ tail = mbox->resultq_read;
+ timeout = 60000000000ULL; /* Empirically ~60 sec. on 2 GHz Cray XT */
+ while (tail == mbox->resultq_write) {
+ if (--timeout == 0) {
+ dev_err(&ssp->pdev->dev,
+ "waited too long getting result from NIC\n");
+ return (u32) -1;
+ }
+ }
+
+ /* Read the result */
+ result = mbox->resultq[tail];
+ mbox->resultq_read = (tail >= RESULT_Q_LENGTH - 1) ? 0 : tail + 1;
+
+ return result;
+}
+
+/* Sends a datagram transmit command to the SeaStar */
+void seastar_ip_tx_cmd(struct ss_priv *ssp,
+ u16 nid,
+ u16 length,
+ u64 address,
+ u16 pending_index)
+{
+ struct command_ip_tx tx_cmd = {
+ .op = COMMAND_IP_TX,
+ .nid = nid,
+ .length = length,
+ .address = address,
+ .pending_index = pending_index,
+ };
+
+ seastar_cmd(ssp, (struct command *) &tx_cmd, 0);
+}
+
+/* Programs the SeaStar's HTB_BI register */
+void seastar_setup_htb_bi(u32 idr)
+{
+ /* Mask the APIC dest setup by Linux, causes problems with SeaStar */
+ idr &= 0xFFFF0000;
+
+ *htb_bi = 0xFD000000 | (idr >> 8);
+}
+
+/* Brings up the low-level Seastar hardware */
+int seastar_hw_init(struct ss_priv *ssp)
+{
+ u32 lower_memory = SEASTAR_HOST_BASE;
+ const int num_eq = 1;
+ u32 lower_pending;
+ u32 lower_eqcb;
+ u32 result;
+ struct command_init init_cmd;
+ struct command_init_eqcb eqcb_cmd;
+ struct command_mark_alive alive_cmd;
+
+ /* Read our NID from SeaStar and write it to the NIC control block */
+ niccb->local_nid = *tx_source;
+
+ printk(KERN_INFO "%s: nid %d (0x%x) version %x built %x\n",
+ __func__, niccb->local_nid, niccb->local_nid,
+ niccb->version, niccb->build_time);
+
+ /* Allocate the PPC memory */
+ lower_pending = lower_memory;
+ lower_memory += NUM_PENDINGS * FW_PENDING_SIZE;
+
+ lower_eqcb = lower_memory;
+ lower_memory = num_eq * FW_EQCB_SIZE;
+
+ /* Initialize the HTB map so that the Seastar can see our memory.
+ * Since we are only doing upper pendings, we just use the
+ * upper_pending_phys instead of the host_phys area. */
+ seastar_map_host_region(ssp, ssp);
+
+ ssp->mailbox = &seastar_mailbox[0];
+ ssp->mailbox_cached_read = ssp->mailbox->commandq_read;
+ ssp->mailbox_cached_write = ssp->mailbox->commandq_write;
+
+ /* Attempt to send a setup command to the NIC */
+ init_cmd.op = COMMAND_INIT;
+ init_cmd.process_index = 1;
+ init_cmd.uid = 0;
+ init_cmd.jid = 0;
+
+ init_cmd.num_pendings = NUM_PENDINGS;
+ init_cmd.pending_tx_limit = NUM_TX_PENDINGS;
+ init_cmd.pending_table_addr = lower_pending;
+ init_cmd.up_pending_table_addr = virt_to_fw(ssp, ssp->pending_table);
+ init_cmd.up_pending_table_ht_addr = 0;
+
+ init_cmd.num_memds = 0;
+ init_cmd.memd_table_addr = 0;
+
+ init_cmd.num_eqcbs = num_eq;
+ init_cmd.eqcb_table_addr = lower_eqcb;
+ init_cmd.eqheap_addr = virt_to_fw(ssp, ssp->eq);
+ init_cmd.eqheap_length = NUM_EQ_ENTRIES * sizeof(ssp->eq[0]);
+
+ init_cmd.shdr_table_ht_addr = 0;
+ init_cmd.result_block_addr = 0;
+ init_cmd.smb_table_addr = 0;
+
+ result = seastar_cmd(ssp, (struct command *) &init_cmd, 1);
+ if (result != 0) {
+ dev_err(&ssp->pdev->dev,
+ "init command failed, result=%d.\n", result);
+ return -1;
+ }
+
+ eqcb_cmd.op = COMMAND_INIT_EQCB;
+ eqcb_cmd.eqcb_index = 0;
+ eqcb_cmd.base = virt_to_fw(ssp, ssp->eq);
+ eqcb_cmd.count = NUM_EQ_ENTRIES;
+
+ result = seastar_cmd(ssp, (struct command *) &eqcb_cmd, 1);
+ if (result != 1) {
+ dev_err(&ssp->pdev->dev,
+ "init_eqcb command failed, result=%d.\n", result);
+ return -1;
+ }
+
+ alive_cmd.op = COMMAND_MARK_ALIVE;
+ alive_cmd.index = 1;
+
+ result = seastar_cmd(ssp, (struct command *) &alive_cmd, 1);
+ if (result != 0) {
+ dev_err(&ssp->pdev->dev,
+ "mark_alive command failed, result=%d\n", result);
+ return -1;
+ }
+
+ return 0;
+}
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/firmware.h linux-2.6.32.7/drivers/net/seastar/firmware.h
--- linux-2.6.32.7-vanilla/drivers/net/seastar/firmware.h 1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.32.7/drivers/net/seastar/firmware.h 2010-02-02 16:39:27.000000000 -0700
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ SeaStar NIC Linux Driver
+
+ Copyright 2009-2010 Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
+ retains certain rights in this software.
+
+ Copyright (c) 2009-2010 Cray Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+ Contact Information:
+ Kevin Pedretti <ktpedre@sandia.gov>
+ Sandia National Laboratories
+ P.O. Box 5800
+ Albuquerque, NM 87185-1319
+
+*******************************************************************************/
+
+#ifndef _SEASTAR_FIRMWARE_H
+#define _SEASTAR_FIRMWARE_H
+
+/*
+ * Number of entries in Host -> SeaStar command queue.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+#define COMMAND_Q_LENGTH 63
+
+/*
+ * Number of entries in SeaStar -> Host result queue.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+#define RESULT_Q_LENGTH 2
+
+/*
+ * SeaStar -> Host event types.
+ *
+ * WARNING: These must match the definitions used by the
+ * closed-source SeaStar firmware.
+ */
+#define EVENT_TX_END 125
+#define EVENT_RX 126
+#define EVENT_RX_EMPTY 127
+
+/*
+ * Host -> SeaStar command types.
+ *
+ * WARNING: These must match the definitions used by the
+ * closed-source SeaStar firmware.
+ */
+#define COMMAND_INIT 0
+#define COMMAND_MARK_ALIVE 1
+#define COMMAND_INIT_EQCB 2
+#define COMMAND_IP_TX 13
+
+/*
+ * Number of entries in the incoming datagram buffer table.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+#define NUM_SKBS 64
+
+/*
+ * Size of the pending structure used by the SeaStar firmware.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+#define FW_PENDING_SIZE 32
+
+/*
+ * Size of the event queue control block structure used by the SeaStar firmware.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+#define FW_EQCB_SIZE 32
+
+/*
+ * SeaStar addresses of important structures in SeaStar memory.
+ *
+ * WARNING: These must match the definitions used by the
+ * closed-source SeaStar firmware.
+ */
+#define SEASTAR_SCRATCH_BASE 0xFFFA0000
+#define SEASTAR_TX_SOURCE 0xFFE00108
+#define SEASTAR_MAILBOX_BASE 0xFFFA0000
+#define SEASTAR_SKB_BASE 0xFFFA4000
+#define SEASTAR_HOST_BASE 0xFFFA5000
+#define SEASTAR_HTB_BASE 0xFFE20000
+#define SEASTAR_HTB_BI 0xFFE20048
+#define SEASTAR_NICCB_BASE 0xFFFFE000
+
+/* Kernel virtual address where the SeaStar memory is mapped. */
+#define SEASTAR_VIRT_BASE (0xFFFFFFFFull << 32)
+
+/* Kernel virtual address of the SeaStar's NIC control block. */
+static volatile struct niccb * const niccb
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_NICCB_BASE);
+
+/* Kernel virtual address of the SeaStar's HTB_BI register. */
+static volatile u32 * const htb_bi
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_HTB_BI);
+
+/* Kernel virtual address of the SeaStar's HyperTransport map. */
+static volatile u32 * const htb_map
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_HTB_BASE);
+
+/* Kernel virtual address of the Host <-> SeaStar mailbox. */
+static struct mailbox * const seastar_mailbox
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_MAILBOX_BASE);
+
+/* Kernel virtual address of the incoming datagram buffer table. */
+static volatile u64 * const seastar_skb
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_SKB_BASE);
+
+/* Kernel virtual address of the SeaStar TX Source register. */
+static volatile u16 * const tx_source
+ = (void *)(SEASTAR_VIRT_BASE + SEASTAR_TX_SOURCE);
+
+/*
+ * The SeaStar NIC Control Block.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct niccb {
+ u32 version; /* 0 */
+ u8 pad[24];
+ u32 build_time; /* 28 */
+ u8 pad2[68];
+ u32 ip_tx; /* 100 */
+ u32 ip_tx_drop; /* 104 */
+ u32 ip_rx; /* 108 */
+ u32 ip_rx_drop; /* 112 */
+ u8 pad3[52];
+ u16 local_nid; /* 168 */
+} __attribute__((packed, aligned));
+
+/*
+ * SeaStar datagram packet wire header.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct sshdr {
+ u16 length; /* 0 */
+ u8 lo_macs; /* 2 */
+ u8 hdr_type; /* 3 */
+} __attribute__((packed));
+
+/*
+ * Generic Host -> SeaStar command structure.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct command {
+ u8 op; /* 0 */
+ u8 pad[63]; /* [1,63] */
+} __attribute__((packed));
+
+/*
+ * Initialize firmware command.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct command_init {
+ u8 op; /* 0 */
+ u8 process_index; /* 1 */
+ u16 pad; /* 2 */
+ u16 pid; /* 4 */
+ u16 jid; /* 6 */
+ u16 num_pendings; /* 8 */
+ u16 num_memds; /* 10 */
+ u16 num_eqcbs; /* 12 */
+ u16 pending_tx_limit; /* 14 */
+ u32 pending_table_addr; /* 16 */
+ u32 up_pending_table_addr; /* 20 */
+ u32 up_pending_table_ht_addr; /* 24 */
+ u32 memd_table_addr; /* 28 */
+ u32 eqcb_table_addr; /* 32 */
+ u32 shdr_table_ht_addr; /* 36 */
+ u32 result_block_addr; /* 40 */
+ u32 eqheap_addr; /* 44 */
+ u32 eqheap_length; /* 48 */
+ u32 smb_table_addr; /* 52 */
+ u32 uid; /* 56 */
+} __attribute__((packed));
+
+/*
+ * Start firmware running command.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct command_mark_alive {
+ u8 op; /* 0 */
+ u8 index; /* 1 */
+} __attribute__((packed));
+
+/*
+ * Initialize event queue command.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct command_init_eqcb {
+ u8 op; /* 0 */
+ u8 pad; /* 1 */
+ u16 eqcb_index; /* 2 */
+ u32 base; /* 4 */
+ u32 count; /* 8 */
+} __attribute__((packed));
+
+/*
+ * Send datagram command.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct command_ip_tx {
+ u8 op; /* 0 */
+ u8 pad; /* 1 */
+ u16 nid; /* 2 */
+ u16 length; /* 4 */
+ u16 pad2; /* 6 */
+ u64 address; /* 8 */
+ u16 pending_index; /* 16 */
+} __attribute__((packed));
+
+/*
+ * Host <-> SeaStar Mailbox structure.
+ *
+ * WARNING: This must match the definition used by the
+ * closed-source SeaStar firmware.
+ */
+struct mailbox {
+ volatile struct command commandq[COMMAND_Q_LENGTH]; /* 0 */
+ volatile u32 resultq[RESULT_Q_LENGTH]; /* 4032 */
+
+ volatile u32 resultq_read; /* 4040 */
+ volatile u32 resultq_write; /* 4044 */
+ volatile u32 commandq_write; /* 4048 */
+ volatile u32 commandq_read; /* 4052 */
+} __attribute__((packed, aligned(PAGE_SIZE)));
+
+struct ss_priv;
+
+extern void seastar_ip_tx_cmd(struct ss_priv *ssp,
+ u16 nid,
+ u16 length,
+ u64 address,
+ u16 pending_index);
+
+extern void seastar_setup_htb_bi(u32 idr);
+
+extern int seastar_hw_init(struct ss_priv *ssp);
+
+#endif
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/main.c linux-2.6.32.7/drivers/net/seastar/main.c
--- linux-2.6.32.7-vanilla/drivers/net/seastar/main.c 1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.32.7/drivers/net/seastar/main.c 2010-02-02 17:52:31.000000000 -0700
@@ -0,0 +1,535 @@
+/*******************************************************************************
+ SeaStar NIC Linux Driver
+
+ Copyright 2009-2010 Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
+ retains certain rights in this software.
+
+ Copyright (c) 2009-2010 Cray Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+ Contact Information:
+ Kevin Pedretti <ktpedre@sandia.gov>
+ Sandia National Laboratories
+ P.O. Box 5800
+ Albuquerque, NM 87185-1319
+
+*******************************************************************************/
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/if_arp.h>
+#include <linux/ip.h>
+#include <linux/htirq.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <net/arp.h>
+#include "firmware.h"
+#include "seastar.h"
+
+#define SEASTAR_VERSION_STR "1.0"
+
+MODULE_DESCRIPTION("Cray SeaStar Native IP driver");
+MODULE_AUTHOR("Maintainer: Kevin Pedretti <ktpedre@sandia.gov>");
+MODULE_VERSION(SEASTAR_VERSION_STR);
+MODULE_LICENSE("GPL");
+
+static struct pending *alloc_tx_pending(struct ss_priv *ssp)
+{
+ struct pending *pending = ssp->tx_pending_free_list;
+ if (!pending)
+ return NULL;
+
+ ssp->tx_pending_free_list = pending->next;
+ pending->next = 0;
+
+ return pending;
+}
+
+static void free_tx_pending(struct ss_priv *ssp, struct pending *pending)
+{
+ pending->next = ssp->tx_pending_free_list;
+ ssp->tx_pending_free_list = pending;
+}
+
+static u16 pending_to_index(struct ss_priv *ssp, struct pending *pending)
+{
+ return pending - ssp->pending_table;
+}
+
+static struct pending *index_to_pending(struct ss_priv *ssp, unsigned int index)
+{
+ return &ssp->pending_table[index];
+}
+
+static void refill_skb(struct net_device *netdev, int i)
+{
+ struct ss_priv *ssp = netdev_priv(netdev);
+ struct sk_buff *skb;
+
+ skb = dev_alloc_skb(netdev->mtu + SKB_PAD);
+ if (!skb) {
+ dev_err(&ssp->pdev->dev, "dev_alloc_skb() failed.\n");
+ return;
+ }
+
+ skb->dev = netdev;
+ skb_reserve(skb, SKB_PAD);
+
+ /* Push it down to the PPC as a quadbyte address */
+ ssp->skb_table_phys[i] = virt_to_phys(skb->data) >> 2;
+ ssp->skb_table_virt[i] = skb;
+}
+
+static int ss_open(struct net_device *netdev)
+{
+ struct ss_priv *ssp = netdev_priv(netdev);
+ int i;
+
+ for (i = 0; i < NUM_SKBS; i++) {
+ ssp->skb_table_phys[i] = 0;
+ ssp->skb_table_virt[i] = 0;
+ refill_skb(netdev, i);
+ }
+
+ netif_start_queue(netdev);
+
+ return 0;
+}
+
+static int eth2ss(struct ss_priv *ssp, struct sk_buff *skb)
+{
+ struct ethhdr *ethhdr;
+ struct sshdr *sshdr;
+ u8 source_lo_mac, dest_lo_mac;
+ u32 qb_len;
+
+ /* Read the "low" bytes of the source and destination MAC addresses */
+ ethhdr = (struct ethhdr *)skb->data;
+ source_lo_mac = ethhdr->h_source[5];
+ dest_lo_mac = ethhdr->h_dest[5];
+
+ /* Drop anything not IPv4 */
+ if (ethhdr->h_proto != ntohs(ETH_P_IP)) {
+ dev_err(&ssp->pdev->dev, "squashing non-IPv4 packet.");
+ return -1;
+ }
+
+ /* Squash broadcast packets, SeaStar doesn't support broadcast */
+ if (dest_lo_mac == 0xFF) {
+ dev_err(&ssp->pdev->dev, "squashing broadcast packet.");
+ return -1;
+ }
+
+ /* We only support 4 bits of virtual hosts per physical node */
+ if ((source_lo_mac & ~0xF) || (dest_lo_mac & ~0xF)) {
+ dev_err(&ssp->pdev->dev, "lo_mac out of range.");
+ return -1;
+ }
+
+ /* Move ahead to allow sshdr to be filled in overtop of the ethhdr */
+ sshdr = (struct sshdr *) skb_pull(skb,
+ (unsigned int)(ETH_HLEN - sizeof(struct sshdr)));
+
+ /* The length in quad bytes, rounded up to the nearest quad byte.
+ * SS header is already counted in skb->len as per skb_pull() above.
+ * The -1 avoids transmitting the CRC on the wire, which is
+ * unnecessary since underlying network is already reliable
+ * (i.e., it has its own CRC, making the Ethernet CRC redundant) */
+ qb_len = (ROUNDUP4(skb->len) >> 2) - 1;
+
+ /* Build the SeaStar header */
+ sshdr->length = qb_len;
+ sshdr->lo_macs = (source_lo_mac << 4) | dest_lo_mac;
+ sshdr->hdr_type = (2 << 5); /* Datagram 2, type 0 == IP */
+
+ return 0;
+}
+
+static int ss2eth(struct sk_buff *skb)
+{
+ struct sshdr *sshdr;
+ struct ethhdr *ethhdr;
+ u8 source_lo_mac, dest_lo_mac;
+
+ /* Read the "low" bytes of the source and destination MAC addresses */
+ sshdr = (struct sshdr *)skb->data;
+ source_lo_mac = (sshdr->lo_macs >> 4);
+ dest_lo_mac = sshdr->lo_macs & 0xF;
+
+ /* Make room for the rest of the ethernet header and zero it */
+ ethhdr = (struct ethhdr *) skb_push(skb,
+ (unsigned int)(ETH_HLEN - sizeof(struct sshdr)));
+ memset(ethhdr, 0x00, ETH_HLEN);
+
+ /* h_proto and h_dest[] are available. Just 0xff h_source[2-5] */
+ ethhdr->h_proto = htons(ETH_P_IP);
+
+ /* We're assuming the source MAC is the same as the local
+ * host's MAC in order to support loopback in promiscous mode */
+ memcpy(ðhdr->h_source, &skb->dev->dev_addr, ETH_ALEN);
+ memcpy(ðhdr->h_dest, &skb->dev->dev_addr, ETH_ALEN);
+ ethhdr->h_source[5] = source_lo_mac;
+ ethhdr->h_dest[5] = dest_lo_mac;
+
+ return 0;
+}
+
+static int ss_tx(struct sk_buff *skb, struct net_device *netdev)
+{
+ unsigned long flags;
+ struct ss_priv *ssp = netdev_priv(netdev);
+ struct ethhdr *eh = (struct ethhdr *)skb->data;
+ struct sshdr *sshdr;
+ u32 dest_nid = ntohl(*(u32 *)eh->h_dest);
+ struct pending *pending = NULL;
+ void *msg;
+
+ spin_lock_irqsave(&ssp->lock, flags);
+
+ if (netif_queue_stopped(netdev)) {
+ spin_unlock_irqrestore(&ssp->lock, flags);
+ return NETDEV_TX_BUSY;
+ }
+
+ /* Convert the SKB from an ethernet frame to a seastar frame */
+ if (eth2ss(ssp, skb)) {
+ netdev->stats.tx_errors++;
+ goto drop;
+ }
+
+ sshdr = (struct sshdr *)skb->data;
+
+ /* Get a tx_pending so that we can track the completion of this SKB */
+ pending = alloc_tx_pending(ssp);
+ if (!pending) {
+ netif_stop_queue(netdev);
+ spin_unlock_irqrestore(&ssp->lock, flags);
+ return NETDEV_TX_BUSY;
+ }
+
+ /* Stash skb away in the pending, will be needed in ss_tx_end() */
+ pending->skb = skb;
+
+ /* Make sure buffer we pass to SeaStar is quad-byte aligned */
+ if (((unsigned long)skb->data & 0x3) == 0) {
+ pending->bounce = NULL;
+ msg = skb->data;
+ } else {
+ /* Need to use bounce buffer to get quad-byte alignment */
+ pending->bounce = kmalloc(skb->len, GFP_KERNEL);
+ if (!pending->bounce) {
+ dev_err(&ssp->pdev->dev, "dev_alloc_skb() failed.\n");
+ goto drop;
+ }
+ memcpy(pending->bounce, skb->data, skb->len);
+ msg = pending->bounce;
+ }
+
+ seastar_ip_tx_cmd(ssp, dest_nid, sshdr->length, virt_to_phys(msg) >> 2,
+ pending_to_index(ssp, pending));
+
+ netdev->stats.tx_packets++;
+ netdev->stats.tx_bytes += skb->len;
+
+ spin_unlock_irqrestore(&ssp->lock, flags);
+ return 0;
+
+drop:
+ dev_kfree_skb_any(skb);
+ if (pending)
+ free_tx_pending(ssp, pending);
+ spin_unlock_irqrestore(&ssp->lock, flags);
+ return 0;
+}
+
+static void ss_tx_end(struct net_device *netdev, unsigned int pending_index)
+{
+ unsigned long flags;
+ struct ss_priv *ssp = netdev_priv(netdev);
+ struct pending *pending = index_to_pending(ssp, pending_index);
+
+ spin_lock_irqsave(&ssp->lock, flags);
+
+ if (pending->skb)
+ dev_kfree_skb_any(pending->skb);
+
+ kfree(pending->bounce);
+
+ free_tx_pending(ssp, pending);
+
+ if (netif_queue_stopped(netdev))
+ netif_wake_queue(netdev);
+
+ spin_unlock_irqrestore(&ssp->lock, flags);
+}
+
+static void ss_rx_skb(struct net_device *netdev, struct sk_buff *skb)
+{
+ struct sshdr *sshdr = (struct sshdr *)skb_tail_pointer(skb);
+
+ const u32 qb_len = sshdr->length;
+ const u32 len = (qb_len + 1) << 2;
+
+ skb_put(skb, len);
+ ss2eth(skb);
+
+ skb->protocol = htons(ETH_P_IP);
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ skb_set_mac_header(skb, 0);
+
+ /* Skip past the ethernet header we just built */
+ skb_pull(skb, ETH_HLEN);
+
+ netdev->stats.rx_packets++;
+ netdev->stats.rx_bytes += len;
+
+ netif_rx(skb);
+}
+
+static void ss_rx(struct net_device *netdev, unsigned int skb_index)
+{
+ struct ss_priv *ssp = netdev_priv(netdev);
+ struct sk_buff *skb = ssp->skb_table_virt[skb_index];
+
+ ssp->skb_table_virt[skb_index] = 0;
+ ss_rx_skb(netdev, skb);
+
+ refill_skb(netdev, skb_index);
+}
+
+static int ss_header_create(struct sk_buff *skb, struct net_device *netdev,
+ unsigned short type, const void *daddr,
+ const void *saddr, unsigned int length)
+{
+ struct ethhdr *eh;
+
+ /* Make room for the ethernet header and zero it */
+ eh = (struct ethhdr *)skb_push(skb, ETH_HLEN);
+ memset(eh, 0, ETH_HLEN);
+
+ /* Although we can only do IPv4, build other packets correctly for
+ * now and drop it in the ndo_start_xmit hook. This way the fact that
+ * these packets are being generated is not invisible. */
+ eh->h_proto = htons(type);
+
+ /* Set the source hardware address */
+ if (!saddr)
+ saddr = netdev->dev_addr;
+ memcpy(eh->h_source, saddr, ETH_ALEN);
+
+ /* Set the destination hardware address */
+ if (daddr) {
+ memcpy(eh->h_dest, daddr, ETH_ALEN);
+ return ETH_HLEN;
+ }
+
+ /* No destination address supplied !?! */
+ return -ETH_HLEN;
+}
+
+static u32 next_event(struct ss_priv *ssp)
+{
+ u32 ev = ssp->eq[ssp->eq_read];
+ if (!ev)
+ return 0;
+
+ ssp->eq[ssp->eq_read] = 0;
+ ssp->eq_read = (ssp->eq_read + 1) % NUM_EQ_ENTRIES;
+
+ return ev;
+}
+
+static void ss_rx_refill(struct net_device *netdev)
+{
+ struct ss_priv *ssp = netdev_priv(netdev);
+ int i;
+
+ for (i = 0; i < NUM_SKBS; i++) {
+ if (ssp->skb_table_virt[i] == 0)
+ refill_skb(netdev, i);
+ }
+}
+
+static irqreturn_t ss_interrupt(int irq, void *dev)
+{
+ struct net_device *netdev = (struct net_device *)dev;
+ struct ss_priv *ssp = netdev_priv(netdev);
+ u32 ev;
+ unsigned int type, index;
+
+ while (1) {
+ ev = next_event(ssp);
+ if (!ev)
+ break;
+
+ type = (ev >> 16) & 0xFFFF;
+ index = (ev >> 0) & 0xFFFF;
+
+ switch (type) {
+
+ case EVENT_TX_END:
+ ss_tx_end(netdev, index);
+ break;
+
+ case EVENT_RX:
+ ss_rx(netdev, index);
+ break;
+
+ case EVENT_RX_EMPTY:
+ ss_rx_refill(netdev);
+ break;
+
+ default:
+ dev_err(&ssp->pdev->dev,
+ "unknown event type (type=%u, index=%u).\n",
+ type, index);
+ }
+ }
+
+ return IRQ_HANDLED;
+}
+
+static const struct net_device_ops ss_netdev_ops = {
+ .ndo_open = ss_open,
+ .ndo_start_xmit = ss_tx,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
+static const struct header_ops ss_header_ops = {
+ .create = ss_header_create,
+};
+
+static void ss_ht_irq_update(struct pci_dev *dev, int irq,
+ struct ht_irq_msg *msg)
+{
+ seastar_setup_htb_bi(msg->address_lo);
+}
+
+static int __devinit ss_probe(struct pci_dev *pdev,
+ const struct pci_device_id *id)
+{
+ struct net_device *netdev;
+ struct ss_priv *ssp;
+ int i, irq, err = 0;
+
+ err = pci_enable_device(pdev);
+ if (err != 0) {
+ dev_err(&pdev->dev, "Could not enable PCI device.\n");
+ return -ENODEV;
+ }
+
+ netdev = alloc_etherdev(sizeof(*ssp));
+ if (netdev == NULL) {
+ dev_err(&pdev->dev, "Could not allocate ethernet device.\n");
+ return -ENOMEM;
+ }
+
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+
+ strcpy(netdev->name, "ss");
+ netdev->netdev_ops = &ss_netdev_ops;
+ netdev->header_ops = &ss_header_ops;
+ netdev->mtu = 16000;
+ netdev->flags = IFF_NOARP;
+
+ /* Setup private state */
+ ssp = netdev_priv(netdev);
+
+ spin_lock_init(&ssp->lock);
+ ssp->skb_table_phys = seastar_skb;
+ ssp->eq_read = 0;
+ ssp->pdev = pdev;
+
+ /* Build the TX pending free list */
+ ssp->tx_pending_free_list = 0;
+ for (i = 0; i < NUM_TX_PENDINGS; i++)
+ free_tx_pending(ssp, index_to_pending(ssp, i));
+
+ irq = __ht_create_irq(pdev, 0, ss_ht_irq_update);
+ if (irq < 0) {
+ dev_err(&pdev->dev, "__ht_create_irq() failed, err=%d.\n", err);
+ goto err_out;
+ }
+
+ err = request_irq(irq, ss_interrupt, IRQF_NOBALANCING,
+ "seastar", netdev);
+ if (err != 0) {
+ dev_err(&pdev->dev, "request_irq() failed, err=%d.\n", err);
+ goto err_out;
+ }
+
+ err = seastar_hw_init(netdev_priv(netdev));
+ if (err != 0) {
+ dev_err(&pdev->dev, "seastar_hw_init() failed, err=%d.\n", err);
+ goto err_out;
+ }
+
+ err = register_netdev(netdev);
+ if (err != 0) {
+ dev_err(&pdev->dev, "register_netdev() failed, err=%d.\n", err);
+ goto err_out;
+ }
+
+ return 0;
+
+err_out:
+ free_netdev(netdev);
+ return err;
+}
+
+static void __devexit ss_remove(struct pci_dev *pdev)
+{
+ struct net_device *netdev = pci_get_drvdata(pdev);
+
+ unregister_netdev(netdev);
+ free_netdev(netdev);
+ pci_disable_device(pdev);
+}
+
+#define PCI_VENDOR_ID_CRAY 0x17DB
+#define PCI_DEVICE_ID_SEASTAR 0x0101
+
+static struct pci_device_id ss_pci_tbl[] = {
+ {PCI_DEVICE(PCI_VENDOR_ID_CRAY, PCI_DEVICE_ID_SEASTAR)},
+ {0},
+};
+
+static struct pci_driver ss_driver = {
+ .name = "seastar",
+ .probe = ss_probe,
+ .remove = __devexit_p(ss_remove),
+ .id_table = ss_pci_tbl,
+};
+
+static __init int ss_init_module(void)
+{
+ printk(KERN_INFO "%s: module loaded (version %s)\n",
+ ss_driver.name, SEASTAR_VERSION_STR);
+
+ return pci_register_driver(&ss_driver);
+}
+
+static __exit void ss_cleanup_module(void)
+{
+ pci_unregister_driver(&ss_driver);
+}
+
+module_init(ss_init_module);
+module_exit(ss_cleanup_module);
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/Makefile linux-2.6.32.7/drivers/net/seastar/Makefile
--- linux-2.6.32.7-vanilla/drivers/net/seastar/Makefile 1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.32.7/drivers/net/seastar/Makefile 2010-02-02 09:12:04.000000000 -0700
@@ -0,0 +1,3 @@
+obj-$(CONFIG_SEASTAR) += seastar.o
+
+seastar-y := main.o firmware.o
diff -uprN -X linux-2.6.32.7-vanilla/Documentation/dontdiff linux-2.6.32.7-vanilla/drivers/net/seastar/seastar.h linux-2.6.32.7/drivers/net/seastar/seastar.h
--- linux-2.6.32.7-vanilla/drivers/net/seastar/seastar.h 1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.32.7/drivers/net/seastar/seastar.h 2010-02-02 16:45:18.000000000 -0700
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ SeaStar NIC Linux Driver
+
+ Copyright 2009-2010 Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
+ retains certain rights in this software.
+
+ Copyright (c) 2009-2010 Cray Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+ Contact Information:
+ Kevin Pedretti <ktpedre@sandia.gov>
+ Sandia National Laboratories
+ P.O. Box 5800
+ Albuquerque, NM 87185-1319
+
+*******************************************************************************/
+
+#ifndef _SEASTAR_H
+#define _SEASTAR_H
+
+/* Rounds up to the nearest quadbyte */
+#define ROUNDUP4(val) ((val + (4-1)) & ~(4-1))
+
+/* SeaStar datagram packet maximum transfer unit size in bytes */
+#define SEASTAR_MTU 8192
+
+/* Number of transmit and receive pending structures */
+#define NUM_TX_PENDINGS 64
+#define NUM_RX_PENDINGS 64
+#define NUM_PENDINGS (NUM_TX_PENDINGS + NUM_RX_PENDINGS)
+
+/* Number of entries in the SeaStar -> Host event queue */
+#define NUM_EQ_ENTRIES 1024
+
+/* When allocating an SKB, allocate this many bytes extra */
+#define SKB_PAD (16 - sizeof(struct sshdr))
+
+/*
+ * Pending structure.
+ * One of these is used to track each in progress transmit.
+ */
+struct pending {
+ struct sk_buff *skb;
+ struct pending *next;
+ void *bounce;
+};
+
+/*
+ * SeaStar driver private data.
+ */
+struct ss_priv {
+ spinlock_t lock;
+
+ unsigned long host_region_phys;
+
+ volatile u64 *skb_table_phys;
+ struct sk_buff *skb_table_virt[NUM_SKBS];
+
+ struct pending pending_table[NUM_PENDINGS];
+ struct pending *tx_pending_free_list;
+
+ u32 eq[NUM_EQ_ENTRIES];
+ unsigned int eq_read;
+
+ struct mailbox *mailbox;
+ unsigned int mailbox_cached_read;
+ unsigned int mailbox_cached_write;
+
+ struct pci_dev *pdev;
+};
+
+#endif
^ permalink raw reply
* Re: [PATCH] sky2: Fix WARNING: at lib/dma-debug.c:902 check_sync
From: David Miller @ 2010-02-03 1:27 UTC (permalink / raw)
To: fujita.tomonori
Cc: jarkao2, alan, shemminger, mbreuer, akpm, flyboy, linux-kernel,
netdev, mchan, pcnet32, romieu, mcarlson, James.Bottomley
In-Reply-To: <20100203101817Z.fujita.tomonori@lab.ntt.co.jp>
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Wed, 3 Feb 2010 10:18:39 +0900
> Can we safely assume that the arch implementations already round
> up/down to the safe boundary internally in this API (they should
> already)?
I can only speak for sparc64 and x86 directly and those are fine.
Any such improper implementations would fail with many common
ethernet drivers already.
> I don't like two DMA docs. I like to make pci_dma_* API obsolete. We
> have the generic DMA API with generic devices so we are always able to
> use the API (as you did with sbus_map_*). The majority arch
> implementations safely call the bus specific DMA functions via the
> generic DMA API. So there are not many things to do. We can just
> convert pci_dma_* to dma_* API slowly.
>
> Opinions?
I have no problem with this.
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver
From: Kevin Pedretti @ 2010-02-03 1:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20100202.134251.15604523.davem@davemloft.net>
Thank you all for the review comments. I believe most of the issues
have been addressed in the patch just posted. I apologize if there are
still issues, and certainly appreciate further comments.
David Miller's comments:
1. Use u32, u16, etc. -> Done.
2. Bad code formating -> Fixed, I believe. Went through everything.
3. Call netif_start_queue() after hw init -> Done.
4. Device only supports IPv4? -> Yes, that's correct. No IPv6 support.
The driver squashes everything but IPv4 in eth2ss().
5. No need for suspend/resume NOPs -> Done. functions removed.
Randy Dunlap's comments:
1. Remove /** comments -> Done.
2. Odd spacing -> I'm not seeing this. Spacing looks correct to me.
3. Limit while (1) loops somehow -> Done.
4. Limit while (1) in intr handler -> In practice we've never seen more
than a few packets processed per interrupt.
Ben Hutching's comments:
1. Spacing looks correct -> Thanks.
Stephen Hemminger's comments:
1. Add ndo_validate_address -> Done
2. May want to use alloc_netdev() -> Didn't do this. Would there be a
substantial advantage to doing this?
3. memset() unnecessary -> removed
Kevin
^ permalink raw reply
* Re: [PATCH] sky2: Fix WARNING: at lib/dma-debug.c:902 check_sync
From: FUJITA Tomonori @ 2010-02-03 1:18 UTC (permalink / raw)
To: davem
Cc: fujita.tomonori, jarkao2, alan, shemminger, mbreuer, akpm, flyboy,
linux-kernel, netdev, mchan, pcnet32, romieu, mcarlson,
James.Bottomley
In-Reply-To: <20100121.223841.145479578.davem@davemloft.net>
Sorry for the late reply,
On Thu, 21 Jan 2010 22:38:41 -0800 (PST)
David Miller <davem@davemloft.net> wrote:
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Fri, 22 Jan 2010 14:11:29 +0900
>
> > Even if 'offset' is zero, 'size' still matters, I think. If 'size' is
> > not a multiple of the cache line size, it's possible that driver
> > writers who aren't familiar with cache would be surprised (it depends
> > on the way their drivers use buffers though).
> >
> > The easiest way for 'completely safe sync for any driver writers' is
> > asking for all the sync parameters must be the same as those passed
> > into the single mapping API. If writes knows what they do, they can do
> > a partial sync with sync_range API. That's the author intention, I
> > guess.
>
> This is not reasonable.
>
> You have to think about how people actually use these
> interfaces.
>
> They have a large buffer, and if they receive a small request they
> want to allocate a smaller buffer, copy into that smaller buffer, and
> give the larger buffer back to the hardware.
>
> It's an optimization, it performs better this way.
>
> If you make it so that the DMA sync has to cover the entire large
> buffer, the whole point of the optimization is taken away.
I talked with James. He is ok with changing (or fixing) this API to
enable users to do a partial sync (I'm ok with that too. I just
guessed that he designed the API in such way intentionally not by
mistake).
Can we safely assume that the arch implementations already round
up/down to the safe boundary internally in this API (they should
already)?
As you know, the patch to remove the description of
dma_sync_single/pci_dma_sync_single/dma_sync_sg/pci_dma_sync_pci that
always require a full sync in DMA-API.txt is already -mm so what we
need to do are:
- adding 'a partial sync' description to PCI-DMA-mapping.txt.
- duplicating the similar description to DMA-API.txt.
I don't like two DMA docs. I like to make pci_dma_* API obsolete. We
have the generic DMA API with generic devices so we are always able to
use the API (as you did with sbus_map_*). The majority arch
implementations safely call the bus specific DMA functions via the
generic DMA API. So there are not many things to do. We can just
convert pci_dma_* to dma_* API slowly.
Opinions?
^ permalink raw reply
* Re: [PATCHv2 NEXT 0/7]qlcnic: add diagnostic tests
From: David Miller @ 2010-02-03 0:00 UTC (permalink / raw)
To: amit.salecha; +Cc: netdev, dhananjay.phadke, ameen.rahman
In-Reply-To: <1265037900-20403-1-git-send-email-amit.salecha@qlogic.com>
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 1 Feb 2010 07:24:53 -0800
> Hi
> Series of 7 patches to add diagnostic test, device identification support and bug fixes.
> These are v2 patches, please ignore previous patches.
> Apply them in net-next-2.6 tree.
All applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next] sky2: Fix TX_MAP_PAGE misspelling
From: David Miller @ 2010-02-03 0:00 UTC (permalink / raw)
To: jarkao2; +Cc: mbreuer, shemminger, netdev
In-Reply-To: <20100201101907.GA12132@ff.dom.local>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Mon, 1 Feb 2010 10:19:07 +0000
> Btw of the dma-debug problem reported by Michael Breuer I spotted
> a tiny misspelling in TX_MAP_PAGE definition introduced by commit
> 6b84dacadbdc3.
>
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Applied.
Thank goodness hex and octal 2 are the same :-)
^ permalink raw reply
* Re: [PATCH] xfrm: avoid spinlock in get_acqseq()
From: David Miller @ 2010-02-02 23:59 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1264773952.3184.22.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 29 Jan 2010 15:05:52 +0100
> Use atomic_inc_return() in get_acqseq() to avoid taking a spinlock
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2] virtio_net: Defer skb allocation in receive path Date: Wed, 13 Jan 2010 12:53:38 -0800
From: David Miller @ 2010-02-02 23:59 UTC (permalink / raw)
To: rusty; +Cc: netdev, virtualization, mashirle, mst
In-Reply-To: <201001292350.04544.rusty@rustcorp.com.au>
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Fri, 29 Jan 2010 23:50:04 +1030
> From: Shirley Ma <mashirle@us.ibm.com>
>
> virtio_net receives packets from its pre-allocated vring buffers, then it
> delivers these packets to upper layer protocols as skb buffs. So it's not
> necessary to pre-allocate skb for each mergable buffer, then frees extra
> skbs when buffers are merged into a large packet. This patch has deferred
> skb allocation in receiving packets for both big packets and mergeable buffers
> to reduce skb pre-allocations and skb frees. It frees unused buffers by calling
> detach_unused_buf in vring, so recv skb queue is not needed.
>
> Signed-off-by: Shirley Ma <xma@us.ibm.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Applied.
^ permalink raw reply
* Re: [PATCH 1/2] virtio: Add ability to detach unused buffers from vrings
From: David Miller @ 2010-02-02 23:59 UTC (permalink / raw)
To: rusty; +Cc: netdev, virtualization, mashirle, mst
In-Reply-To: <201001292349.05360.rusty@rustcorp.com.au>
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Fri, 29 Jan 2010 23:49:05 +1030
> From: Shirley Ma <mashirle@us.ibm.com>
>
> There's currently no way for a virtio driver to ask for unused
> buffers, so it has to keep a list itself to reclaim them at shutdown.
> This is redundant, since virtio_ring stores that information. So
> add a new hook to do this.
>
> Signed-off-by: Shirley Ma <xma@us.ibm.com>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Applied.
^ permalink raw reply
* Re: [PATCH] seastar - SeaStar Ethernet driver
From: Stephen Hemminger @ 2010-02-02 23:38 UTC (permalink / raw)
To: Kevin Pedretti; +Cc: netdev, linux-kernel
In-Reply-To: <20100202205845.GE5246@hawkeye.sandia.gov>
On Tue, 2 Feb 2010 13:58:45 -0700
"Kevin Pedretti" <ktpedre@sandia.gov> wrote:
> +
> +static const struct net_device_ops ss_netdev_ops = {
> + .ndo_open = ss_open,
> + .ndo_start_xmit = ss_tx,
> + .ndo_set_mac_address = eth_mac_addr,
> +};
You should have a validate_address as well.
> +
> +
> +static const struct header_ops ss_header_ops = {
> + .create = ss_header_create,
> +};
> +
> +
> +static void ss_ht_irq_update(struct pci_dev *dev, int irq,
> + struct ht_irq_msg *msg)
> +{
> + seastar_setup_htb_bi(msg->address_lo);
> +}
> +
> +
> +static int __devinit ss_probe(struct pci_dev *pdev,
> + const struct pci_device_id *id)
> +{
> + struct net_device *netdev;
> + struct ss_priv *ssp;
> + int i, irq, err = 0;
> +
> + err = pci_enable_device(pdev);
> + if (err != 0) {
> + dev_err(&pdev->dev, "Could not enable PCI device.\n");
> + return -ENODEV;
> + }
> +
> + netdev = alloc_etherdev(sizeof(*ssp));
> + if (netdev == NULL) {
> + dev_err(&pdev->dev, "Could not allocate ethernet device.\n");
> + return -ENOMEM;
> + }
You may want to use alloc_netdev() since this starts to look
like a non-ethernet device.
> +
> + SET_NETDEV_DEV(netdev, &pdev->dev);
> +
> + strcpy(netdev->name, "ss");
> + netdev->netdev_ops = &ss_netdev_ops;
> + netdev->header_ops = &ss_header_ops;
> + netdev->mtu = 16000;
> + netdev->flags = IFF_NOARP;
> +
> + /* Setup private state */
> + ssp = netdev_priv(netdev);
> + memset(ssp, 0, sizeof(*ssp));
memset is unnecessary, since alloc_netdev/alloc_etherdev zero that area
already.
--
^ permalink raw reply
* Re: [PATCH 0/2] virtio net improvements
From: David Miller @ 2010-02-02 23:29 UTC (permalink / raw)
To: rusty; +Cc: netdev, virtualization, mashirle, mst
In-Reply-To: <201002030957.06307.rusty@rustcorp.com.au>
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Wed, 3 Feb 2010 09:57:06 +1030
> On Fri, 29 Jan 2010 11:46:43 pm Rusty Russell wrote:
>> Hi Dave,
>>
>> Nice driver optimization from Shirley, but requires a new virtio hook.
>> Do you want to take both? I have nothing else overlapping it.
>
> Dave, any news on this?
Just slowly creeping up the backlog :-)
^ permalink raw reply
* Re: [PATCH 0/2] virtio net improvements
From: Rusty Russell @ 2010-02-02 23:27 UTC (permalink / raw)
To: netdev; +Cc: David Miller, virtualization, Shirley Ma, Michael S. Tsirkin
In-Reply-To: <201001292346.43675.rusty@rustcorp.com.au>
On Fri, 29 Jan 2010 11:46:43 pm Rusty Russell wrote:
> Hi Dave,
>
> Nice driver optimization from Shirley, but requires a new virtio hook.
> Do you want to take both? I have nothing else overlapping it.
Dave, any news on this? Shirley, I note that your final commit message did
not contain this information from your original version:
Tests have been done for small packets, big packets and
mergeable buffers.
The single netperf TCP_STREAM performance improved for host to guest.
It also reduces UDP packets drop rate.
The netperf laptop results were:
mtu=1500
netperf -H xxx -l 120
w/o patch w/i patch (two runs)
guest to host: 3336.84Mb/s 3730.14Mb/s ~ 3582.88Mb/s
host to guest: 3165.10Mb/s 3370.39Mb/s ~ 3407.96Mb/s
Thanks,
Rusty.
^ permalink raw reply
* Re: [PATCH] sky2: receive dma mapping error handling
From: Andi Kleen @ 2010-02-02 22:44 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Michael Breuer, Jarek Poplawski, David Miller, akpm, flyboy,
linux-kernel, netdev, Michael Chan, Don Fry, Francois Romieu,
Matt Carlson
In-Reply-To: <20100128153643.0fca3c51@nehalam>
Stephen Hemminger <shemminger@linux-foundation.org> writes:
> - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
> - re->frag_addr[i] = pci_map_page(pdev,
> +
> +map_page_error:
> + while (--i >= 0) {
> + pci_unmap_page(pdev, re->frag_addr[i],
> + skb_shinfo(skb)->frags[i].size,
> + PCI_DMA_FROMDEVICE);
> + }
> +
> + pci_unmap_single(pdev, re->data_addr, pci_unmap_len(re, data_size),
> + PCI_DMA_FROMDEVICE);
Better add a helper somewhere to do this, doesn't make sense
to duplicate this in all drivers (lots of drivers have similar
problems)
I remember looking at this some time ago but for some reason
the patches never made it out.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* [patch 1/1] net/rds: remove uses of NIPQUAD, use %pI4
From: akpm @ 2010-02-02 22:43 UTC (permalink / raw)
To: davem; +Cc: netdev, akpm, joe, andy.grover
From: Joe Perches <joe@perches.com>
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Grover <andy.grover@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/rds/tcp_connect.c | 7 +++----
net/rds/tcp_listen.c | 6 +++---
net/rds/tcp_send.c | 4 ++--
3 files changed, 8 insertions(+), 9 deletions(-)
diff -puN net/rds/tcp_connect.c~net-rds-remove-uses-of-nipquad-use-%pi4 net/rds/tcp_connect.c
--- a/net/rds/tcp_connect.c~net-rds-remove-uses-of-nipquad-use-%pi4
+++ a/net/rds/tcp_connect.c
@@ -90,8 +90,8 @@ int rds_tcp_conn_connect(struct rds_conn
ret = sock->ops->bind(sock, (struct sockaddr *)&src, sizeof(src));
if (ret) {
- rdsdebug("bind failed with %d at address %u.%u.%u.%u\n",
- ret, NIPQUAD(conn->c_laddr));
+ rdsdebug("bind failed with %d at address %pI4\n",
+ ret, &conn->c_laddr);
goto out;
}
@@ -108,8 +108,7 @@ int rds_tcp_conn_connect(struct rds_conn
O_NONBLOCK);
sock = NULL;
- rdsdebug("connect to address %u.%u.%u.%u returned %d\n",
- NIPQUAD(conn->c_faddr), ret);
+ rdsdebug("connect to address %pI4 returned %d\n", &conn->c_faddr, ret);
if (ret == -EINPROGRESS)
ret = 0;
diff -puN net/rds/tcp_listen.c~net-rds-remove-uses-of-nipquad-use-%pi4 net/rds/tcp_listen.c
--- a/net/rds/tcp_listen.c~net-rds-remove-uses-of-nipquad-use-%pi4
+++ a/net/rds/tcp_listen.c
@@ -66,9 +66,9 @@ static int rds_tcp_accept_one(struct soc
inet = inet_sk(new_sock->sk);
- rdsdebug("accepted tcp %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n",
- NIPQUAD(inet->inet_saddr), ntohs(inet->inet_sport),
- NIPQUAD(inet->inet_daddr), ntohs(inet->inet_dport));
+ rdsdebug("accepted tcp %pI4:%u -> %pI4:%u\n",
+ &inet->inet_saddr, ntohs(inet->inet_sport),
+ &inet->inet_daddr, ntohs(inet->inet_dport));
conn = rds_conn_create(inet->inet_saddr, inet->inet_daddr,
&rds_tcp_transport, GFP_KERNEL);
diff -puN net/rds/tcp_send.c~net-rds-remove-uses-of-nipquad-use-%pi4 net/rds/tcp_send.c
--- a/net/rds/tcp_send.c~net-rds-remove-uses-of-nipquad-use-%pi4
+++ a/net/rds/tcp_send.c
@@ -193,9 +193,9 @@ out:
rds_tcp_stats_inc(s_tcp_sndbuf_full);
ret = 0;
} else {
- printk(KERN_WARNING "RDS/tcp: send to %u.%u.%u.%u "
+ printk(KERN_WARNING "RDS/tcp: send to %pI4 "
"returned %d, disconnecting and reconnecting\n",
- NIPQUAD(conn->c_faddr), ret);
+ &conn->c_faddr, ret);
rds_conn_drop(conn);
}
}
_
^ permalink raw reply
* [patch 4/4] mISDN: positive error return should be negative in mode_hfcmulti()
From: akpm @ 2010-02-02 22:43 UTC (permalink / raw)
To: isdn; +Cc: netdev, akpm, roel.kluin
From: Roel Kluin <roel.kluin@gmail.com>
The error return should be negative. Its only caller that acts upon its
return, handle_bmsg(), transmits the positive error but can also return
negative errors.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/isdn/hardware/mISDN/hfcmulti.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN drivers/isdn/hardware/mISDN/hfcmulti.c~misdn-positive-error-return-should-be-negative-in-mode_hfcmulti drivers/isdn/hardware/mISDN/hfcmulti.c
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c~misdn-positive-error-return-should-be-negative-in-mode_hfcmulti
+++ a/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -2846,7 +2846,7 @@ mode_hfcmulti(struct hfc_multi *hc, int
int conf;
if (ch < 0 || ch > 31)
- return EINVAL;
+ return -EINVAL;
oslot_tx = hc->chan[ch].slot_tx;
oslot_rx = hc->chan[ch].slot_rx;
conf = hc->chan[ch].conf;
_
^ permalink raw reply
* [patch 1/4] hisax: timeout off by one in waitrecmsg()
From: akpm @ 2010-02-02 22:43 UTC (permalink / raw)
To: isdn; +Cc: netdev, akpm, roel.kluin
From: Roel Kluin <roel.kluin@gmail.com>
With `while (timeout++ < maxdelay)' timeout reaches maxdelay + 1 after the
loop This is probably unlikely a problem in practice.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/isdn/hisax/isar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN drivers/isdn/hisax/isar.c~hisax-timeout-off-by-one-in-waitrecmsg drivers/isdn/hisax/isar.c
--- a/drivers/isdn/hisax/isar.c~hisax-timeout-off-by-one-in-waitrecmsg
+++ a/drivers/isdn/hisax/isar.c
@@ -138,7 +138,7 @@ waitrecmsg(struct IsdnCardState *cs, u_c
while((!(cs->BC_Read_Reg(cs, 0, ISAR_IRQBIT) & ISAR_IRQSTA)) &&
(timeout++ < maxdelay))
udelay(1);
- if (timeout >= maxdelay) {
+ if (timeout > maxdelay) {
printk(KERN_WARNING"isar recmsg IRQSTA timeout\n");
return(0);
}
_
^ permalink raw reply
* [patch 2/4] hardware/mISDN/mISDNinfineon.c: bail out of loop on error
From: akpm @ 2010-02-02 22:43 UTC (permalink / raw)
To: isdn; +Cc: netdev, akpm, darrenrjenkins
From: Darren Jenkins <darrenrjenkins@gmail.com>
If setup_instance() fails we kfree() the card, and then use it in the next
loop iteration. So lets bail out of the loop instead.
Coverity CID: 13357
Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/isdn/hardware/mISDN/mISDNinfineon.c | 1 +
1 file changed, 1 insertion(+)
diff -puN drivers/isdn/hardware/mISDN/mISDNinfineon.c~hardware-misdn-misdninfineonc-bail-out-of-loop-on-error drivers/isdn/hardware/mISDN/mISDNinfineon.c
--- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c~hardware-misdn-misdninfineonc-bail-out-of-loop-on-error
+++ a/drivers/isdn/hardware/mISDN/mISDNinfineon.c
@@ -1133,6 +1133,7 @@ inf_probe(struct pci_dev *pdev, const st
if (err) {
kfree(sc);
release_card(card);
+ break;
} else
card->sc[i - 1] = sc;
}
_
^ permalink raw reply
* [patch 3/4] isdn: mISDN, don't compile unused stuff
From: akpm @ 2010-02-02 22:43 UTC (permalink / raw)
To: isdn; +Cc: netdev, akpm, jirislaby
From: Jiri Slaby <jirislaby@gmail.com>
Remove these compiler warnings:
drivers/isdn/hardware/mISDN/w6692.c:534: warning: `setvolume' defined but not used
drivers/isdn/hardware/mISDN/w6692.c:561: warning: `enable_pots' defined but not used
by moving the functions inside #if 0 ... #endif. And an alternative is
to remove them completely if nobody has plans to use them.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/isdn/hardware/mISDN/w6692.c | 2 ++
1 file changed, 2 insertions(+)
diff -puN drivers/isdn/hardware/mISDN/w6692.c~isdn-misdn-dont-compile-unused-stuff drivers/isdn/hardware/mISDN/w6692.c
--- a/drivers/isdn/hardware/mISDN/w6692.c~isdn-misdn-dont-compile-unused-stuff
+++ a/drivers/isdn/hardware/mISDN/w6692.c
@@ -529,6 +529,7 @@ W6692_fill_Bfifo(struct w6692_ch *wch)
}
}
+#if 0
static int
setvolume(struct w6692_ch *wch, int mic, struct sk_buff *skb)
{
@@ -571,6 +572,7 @@ enable_pots(struct w6692_ch *wch)
WriteW6692(card, W_PCTL, card->pctl);
return 0;
}
+#endif
static int
disable_pots(struct w6692_ch *wch)
_
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox