Please pull from git://git.infradead.org/~dwmw2/solos-2.6.git
This contains a bunch of updates to the Solos PCI driver (full patch
below for review):
David Woodhouse (27):
solos: Fix length header in FPGA transfers
solos: Clean up firmware loading code
solos: Kill global 'opens' count.
solos: Handle attribute show/store in kernel more sanely
solos: Add initial list of parameters
solos: Handle new line status change packets, hook up to ATM layer info
solos: Kill existing connections on link down event
solos: Reject non-AAL5 connections.... for now
solos: Add SNR and Attn to status packet, fix oops on load
solos: Fix under-allocation of skb size for get/set parameters
solos: Remove parameter group from sysfs on ATM dev deregister
solos: First attempt at DMA support
solos: Tidy up DMA handling a little. Still untested
solos: Tidy up tx_mask handling for ports which need TX
solos: Remove unused loopback debug stuff
solos: Remove IRQF_DISABLED, don't frob IRQ enable on the FPGA in solos_irq()
solos: Remove superfluous wait_queue_head_t from struct solos_param
solos: Fix various bugs in status packet handling
solos: Clean up handling of card->tx_mask a little
solos: Remove debugging, commented-out test code
solos: Add 'reset' module parameter to reset the DSL chips on load
solos: Tidy up status interrupt handling, cope with 'ERROR' status
solos: Don't clear config registers at startup
solos: Set RX empty flag at startup only for !dma mode
solos: Swap upstream/downstream rates in status packet, clean up some more
solos: Reset device on unload, free pending skbs
solos: Disable DMA until we have an FPGA update with it actually implemented.
Nathan Williams (1):
solos: Automatically determine number of ports
Simon Farnsworth (2):
solos: Slight debugging improvements
solos: FPGA and firmware update ...From: David Woodhouse <dwmw2@infradead.org> So if I don't like patch 3 and want to discuss it as a unit, what do I do? Pull the patch out of your GIT repo and start a thread to discuss it? Come on, post the whole series, please. :-/ Nobody can review this huge hunk of intertwines changes. --
On Tue, 17 Mar 2009 12:23:17 -0700 (PDT) I regret ever adding sysfs for network devices when it gets used for configuration interfaces like this mess. --
Yeah, I wasn't massively keen on that either. You didn't speak up a while back when I asked for opinions on how best to handle this. Feel free to do so now... -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation --
If you like :) Since the complete patch isn't that large, I figured it was probably Since the complete patch isn't that large, I figured it was probably easier to review that way. I've posted them individually now. -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation --
This is just a straight pull in of changes, syncing us up to 0.07 from
openadsl.sf.net
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Signed-off-by: Simon Farnsworth <simon@farnz.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 169 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 3daa3a3..2b472c8 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -9,6 +9,7 @@
*
* Authors: Nathan Williams <nathan@traverse.com.au>
* David Woodhouse <dwmw2@infradead.org>
+ * Treker Chen <treker@xrio.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -36,8 +37,9 @@
#include <linux/sysfs.h>
#include <linux/device.h>
#include <linux/kobject.h>
+#include <linux/firmware.h>
-#define VERSION "0.04"
+#define VERSION "0.07"
#define PTAG "solos-pci"
#define CONFIG_RAM_SIZE 128
@@ -45,16 +47,27 @@
#define IRQ_EN_ADDR 0x78
#define FPGA_VER 0x74
#define IRQ_CLEAR 0x70
-#define BUG_FLAG 0x6C
+#define WRITE_FLASH 0x6C
+#define PORTS 0x68
+#define FLASH_BLOCK 0x64
+#define FLASH_BUSY 0x60
+#define FPGA_MODE 0x5C
+#define FLASH_MODE 0x58
#define DATA_RAM_SIZE 32768
#define BUF_SIZE 4096
+#define FPGA_PAGE 528 /* FPGA flash page size*/
+#define SOLOS_PAGE 512 /* Solos flash page size*/
+#define FPGA_BLOCK (FPGA_PAGE * 8) /* FPGA flash block size*/
+#define SOLOS_BLOCK (SOLOS_PAGE * 8) /* Solos flash block size*/
#define RX_BUF(card, nr) ((card->buffers) + (nr)*BUF_SIZE*2)
#define TX_BUF(card, nr) ((card->buffers) + (nr)*BUF_SIZE*2 + BUF_SIZE)
static int debug = 0;
static int atmdebug = 0;
+static int firmware_upgrade = 0;
+static int fpga_upgrade = 0;
struct pkt_hdr {
__le16 size;
@@ -80,6 +93,7 @@ struct solos_card {
spinlock_t ...We no longer try to load firmware while the ATM is up and running.
However, this means that we _do_ make init_module() wait for it, and it
takes a long time for now (since we're using ultra-conservative code in
the FPGA for that too).
The inner loop which uses swahb32p() was by Simon Farnsworth.
Simon has patches which migrate us to request_firmware_nowait(), for
which we'll actually need to take down the ATM devices, do the upgrade,
then reregister them.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 209 ++++++++++++++++------------------------------
1 files changed, 73 insertions(+), 136 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 2b472c8..89bdf73 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -93,7 +93,7 @@ struct solos_card {
spinlock_t cli_queue_lock;
struct sk_buff_head tx_queue[4];
struct sk_buff_head cli_queue[4];
- int flash_chip;
+ wait_queue_head_t fw_wq;
};
#define SOLOS_CHAN(atmdev) ((int)(unsigned long)(atmdev)->phy_data)
@@ -112,11 +112,7 @@ module_param(firmware_upgrade, int, 0444);
module_param(fpga_upgrade, int, 0444);
static int opens;
-static struct firmware *fw;
-static int flash_offset;
-void flash_upgrade(struct solos_card *);
-void flash_write(struct solos_card *);
static void fpga_queue(struct solos_card *card, int port, struct sk_buff *skb,
struct atm_vcc *vcc);
static int fpga_tx(struct solos_card *);
@@ -202,129 +198,73 @@ static ssize_t console_store(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR(console, 0644, console_show, console_store);
-void flash_upgrade(struct solos_card *card){
+static int flash_upgrade(struct solos_card *card, int chip)
+{
+ const struct firmware *fw;
+ const char *fw_name;
uint32_t data32 = 0;
int blocksize = 0;
int numblocks = 0;
- dev_info(&card->dev->dev, "Flash upgrade started\n");
- if (card->flash_chip == 0) {
- if ...The length field shouldn't ever include the size of the header itself.
This fixes the problem that some people were seeing with 1500-byte
packets.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 72fc0f7..f030954 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -356,7 +356,7 @@ static int popen(struct atm_vcc *vcc)
}
header = (void *)skb_put(skb, sizeof(*header));
- header->size = cpu_to_le16(sizeof(*header));
+ header->size = cpu_to_le16(0);
header->vpi = cpu_to_le16(vcc->vpi);
header->vci = cpu_to_le16(vcc->vci);
header->type = cpu_to_le16(PKT_POPEN);
@@ -389,7 +389,7 @@ static void pclose(struct atm_vcc *vcc)
}
header = (void *)skb_put(skb, sizeof(*header));
- header->size = cpu_to_le16(sizeof(*header));
+ header->size = cpu_to_le16(0);
header->vpi = cpu_to_le16(vcc->vpi);
header->vci = cpu_to_le16(vcc->vci);
header->type = cpu_to_le16(PKT_PCLOSE);
@@ -507,6 +507,7 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
struct solos_card *card = vcc->dev->dev_data;
struct sk_buff *skb2 = NULL;
struct pkt_hdr *header;
+ int pktlen;
//dev_dbg(&card->dev->dev, "psend called.\n");
//dev_dbg(&card->dev->dev, "dev,vpi,vci = %d,%d,%d\n",SOLOS_CHAN(vcc->dev),vcc->vpi,vcc->vci);
@@ -524,7 +525,8 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
return 0;
}
- if (skb->len > (BUF_SIZE - sizeof(*header))) {
+ pktlen = skb->len;
+ if (pktlen > (BUF_SIZE - sizeof(*header))) {
dev_warn(&card->dev->dev, "Length of PDU is too large. Dropping PDU.\n");
solos_pop(vcc, skb);
return 0;
@@ -546,7 +548,8 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
header = (void *)skb_push(skb, sizeof(*header));
- header->size = cpu_to_le16(skb->len);
+ /* This does _not_ include the size of the header ...Print a message if pskb_expand_head fails.
Make atmdebug writable by root, so that you can turn printing of data sent to
and received from the card on and off at runtime - useful for tracking
corruption.
Signed-off-by: Simon Farnsworth <simon@farnz.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index f030954..3daa3a3 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -91,7 +91,7 @@ MODULE_LICENSE("GPL");
MODULE_PARM_DESC(debug, "Enable Loopback");
MODULE_PARM_DESC(atmdebug, "Print ATM data");
module_param(debug, int, 0444);
-module_param(atmdebug, int, 0444);
+module_param(atmdebug, int, 0644);
static int opens;
@@ -541,6 +541,7 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
ret = pskb_expand_head(skb, expand_by, 0, GFP_ATOMIC);
if (ret) {
+ dev_warn(&card->dev->dev, "pskb_expand_head failed.\n");
solos_pop(vcc, skb);
return ret;
}
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 89bdf73..5179dbf 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -111,8 +111,6 @@ module_param(atmdebug, int, 0644);
module_param(firmware_upgrade, int, 0444);
module_param(fpga_upgrade, int, 0444);
-static int opens;
-
static void fpga_queue(struct solos_card *card, int port, struct sk_buff *skb,
struct atm_vcc *vcc);
static int fpga_tx(struct solos_card *);
@@ -455,10 +453,6 @@ static int popen(struct atm_vcc *vcc)
set_bit(ATM_VF_READY, &vcc->flags);
list_vccs(0);
- if (!opens)
- iowrite32(1, card->config_regs + IRQ_EN_ADDR);
-
- opens++; //count open PVCs
return 0;
}
@@ -484,8 +478,6 @@ static void pclose(struct atm_vcc *vcc)
fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL);
// dev_dbg(&card->dev->dev, "Close for vpi %d and vci %d on interface %d\n", vcc->vpi, vcc->vci, SOLOS_CHAN(vcc->dev));
- if (!--opens)
- iowrite32(0, card->config_regs + IRQ_EN_ADDR);
clear_bit(ATM_VF_ADDR, &vcc->flags);
clear_bit(ATM_VF_READY, &vcc->flags);
@@ -800,8 +792,6 @@ static int atm_init(struct solos_card *card)
{
int i;
- opens = 0;
-
for (i = 0; i < card->nr_ports; i++) {
skb_queue_head_init(&card->tx_queue[i]);
skb_queue_head_init(&card->cli_queue[i]);
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 4c87dfb..c289b62 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -132,6 +132,7 @@ static int fpga_tx(struct solos_card *);
static irqreturn_t solos_irq(int irq, void *dev_id);
static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
static int list_vccs(int vci);
+static void release_vccs(struct atm_dev *dev);
static int atm_init(struct solos_card *);
static void atm_remove(struct solos_card *);
static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
@@ -332,7 +333,10 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
str = next_string(skb);
if (!strcmp(str, "Showtime"))
state = ATM_PHY_SIG_FOUND;
- else state = ATM_PHY_SIG_LOST;
+ else {
+ state = ATM_PHY_SIG_LOST;
+ release_vccs(card->atmdev[port]);
+ }
card->atmdev[port]->link_rate = rate_down;
card->atmdev[port]->signal = state;
@@ -683,7 +687,7 @@ static int list_vccs(int vci)
vcc->vci);
}
} else {
- for(i=0; i<32; i++){
+ for(i = 0; i < VCC_HTABLE_SIZE; i++){
head = &vcc_hash[i];
sk_for_each(s, node, head) {
num_found ++;
@@ -699,6 +703,28 @@ static int list_vccs(int vci)
return num_found;
}
+static void release_vccs(struct atm_dev *dev)
+{
+ int i;
+
+ write_lock_irq(&vcc_sklist_lock);
+ for (i = 0; i < VCC_HTABLE_SIZE; i++) {
+ struct hlist_head *head = &vcc_hash[i];
+ struct hlist_node *node, *tmp;
+ struct sock *s;
+ struct atm_vcc *vcc;
+
+ sk_for_each_safe(s, node, tmp, head) {
+ vcc = atm_sk(s);
+ if (vcc->dev == dev) {
+ ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 92 insertions(+), 1 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index b0c4676..4c87dfb 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -82,6 +82,7 @@ struct pkt_hdr {
#define PKT_COMMAND 1
#define PKT_POPEN 3
#define PKT_PCLOSE 4
+#define PKT_STATUS 5
struct solos_card {
void __iomem *config_regs;
@@ -275,6 +276,72 @@ static ssize_t solos_param_store(struct device *dev, struct device_attribute *at
return ret;
}
+static char *next_string(struct sk_buff *skb)
+{
+ int i = 0;
+ char *this = skb->data;
+
+ while (i < skb->len) {
+ if (this[i] == '\n') {
+ this[i] = 0;
+ skb_pull(skb, i);
+ return this;
+ }
+ }
+ return NULL;
+}
+
+/*
+ * Status packet has fields separated by \n, starting with a version number
+ * for the information therein. Fields are....
+ *
+ * packet version
+ * TxBitRate (version >= 1)
+ * RxBitRate (version >= 1)
+ * State (version >= 1)
+ */
+static int process_status(struct solos_card *card, int port, struct sk_buff *skb)
+{
+ char *str, *end;
+ int ver, rate_up, rate_down, state;
+
+ if (!card->atmdev[port])
+ return -ENODEV;
+
+ str = next_string(skb);
+ if (!str)
+ return -EIO;
+
+ ver = simple_strtol(str, NULL, 10);
+ if (ver < 1) {
+ dev_warn(&card->dev->dev, "Unexpected status interrupt version %d\n",
+ ver);
+ return -EIO;
+ }
+
+ str = next_string(skb);
+ rate_up = simple_strtol(str, &end, 10);
+ if (*end)
+ return -EIO;
+
+ str = next_string(skb);
+ rate_down = simple_strtol(str, &end, 10);
+ if (*end)
+ return -EIO;
+
+ str = next_string(skb);
+ if (!strcmp(str, "Showtime"))
+ state = ATM_PHY_SIG_FOUND;
+ else state = ATM_PHY_SIG_LOST;
+
+ card->atmdev[port]->link_rate = rate_down;
+ card->atmdev[port]->signal = ...I don't much like the trick with multiple inclusions of solos-attrlist.c but don't really see a saner way to do it without repeating the list. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> --- drivers/atm/solos-attrlist.c | 70 ++++++++++++++++++++++++++++++++++++++++++ drivers/atm/solos-pci.c | 30 ++++++++++++++--- 2 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 drivers/atm/solos-attrlist.c diff --git a/drivers/atm/solos-attrlist.c b/drivers/atm/solos-attrlist.c new file mode 100644 index 0000000..efa2808 --- /dev/null +++ b/drivers/atm/solos-attrlist.c @@ -0,0 +1,70 @@ +SOLOS_ATTR_RO(DriverVersion) +SOLOS_ATTR_RO(APIVersion) +SOLOS_ATTR_RO(FirmwareVersion) +// SOLOS_ATTR_RO(DspVersion) +// SOLOS_ATTR_RO(CommonHandshake) +SOLOS_ATTR_RO(Connected) +SOLOS_ATTR_RO(OperationalMode) +SOLOS_ATTR_RO(State) +SOLOS_ATTR_RO(Watchdog) +SOLOS_ATTR_RO(OperationProgress) +SOLOS_ATTR_RO(LastFailed) +SOLOS_ATTR_RO(TxBitRate) +SOLOS_ATTR_RO(RxBitRate) +// SOLOS_ATTR_RO(DeltACTATPds) +// ...
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 2978699..2dca5ff 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -159,7 +159,7 @@ static ssize_t solos_param_show(struct device *dev, struct device_attribute *att
buflen = strlen(attr->attr.name) + 10;
- skb = alloc_skb(buflen, GFP_KERNEL);
+ skb = alloc_skb(sizeof(*header) + buflen, GFP_KERNEL);
if (!skb) {
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in solos_param_show()\n");
return -ENOMEM;
@@ -215,7 +215,7 @@ static ssize_t solos_param_store(struct device *dev, struct device_attribute *at
buflen = strlen(attr->attr.name) + 11 + count;
- skb = alloc_skb(buflen, GFP_KERNEL);
+ skb = alloc_skb(sizeof(*header) + buflen, GFP_KERNEL);
if (!skb) {
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in solos_param_store()\n");
return -ENOMEM;
--
1.6.0.6
--
Signed-off-by: Nathan Williams <nathan@traverse.com.au> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> --- drivers/atm/solos-pci.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 1ff7304..6fe8f8f 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -1104,7 +1104,8 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) iowrite32(0xF0, card->config_regs + FLAGS_ADDR); } - card->nr_ports = 2; /* FIXME: Detect daughterboard */ + data32 = ioread32(card->config_regs + PORTS); + card->nr_ports = (data32 & 0x000000FF); pci_set_drvdata(dev, card); -- 1.6.0.6 --
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 49 ++++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 8121f85..5e228a3 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -293,13 +293,15 @@ static char *next_string(struct sk_buff *skb)
{
int i = 0;
char *this = skb->data;
-
- while (i < skb->len) {
+
+ for (i = 0; i < skb->len; i++) {
if (this[i] == '\n') {
this[i] = 0;
- skb_pull(skb, i);
+ skb_pull(skb, i + 1);
return this;
}
+ if (!isprint(this[i]))
+ return NULL;
}
return NULL;
}
@@ -316,7 +318,7 @@ static char *next_string(struct sk_buff *skb)
static int process_status(struct solos_card *card, int port, struct sk_buff *skb)
{
char *str, *end, *state_str;
- int ver, rate_up, rate_down, state, snr, attn;
+ int ver, rate_up, rate_down, state;
if (!card->atmdev[port])
return -ENODEV;
@@ -333,16 +335,22 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
}
str = next_string(skb);
+ if (!str)
+ return -EIO;
rate_up = simple_strtol(str, &end, 10);
if (*end)
return -EIO;
str = next_string(skb);
+ if (!str)
+ return -EIO;
rate_down = simple_strtol(str, &end, 10);
if (*end)
return -EIO;
state_str = next_string(skb);
+ if (!state_str)
+ return -EIO;
if (!strcmp(state_str, "Showtime"))
state = ATM_PHY_SIG_FOUND;
else {
@@ -350,25 +358,24 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
release_vccs(card->atmdev[port]);
}
- str = next_string(skb);
- snr = simple_strtol(str, &end, 10);
- if (*end)
- return -EIO;
-
- str = next_string(skb);
- attn = simple_strtol(str, &end, 10);
- if (*end)
- return -EIO;
-
- if (state == ATM_PHY_SIG_LOST && !rate_up && !rate_down)
+ if (state == ATM_PHY_SIG_LOST) {
...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index acba08d..bf59c40 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -100,6 +100,7 @@ struct solos_card {
void __iomem *config_regs;
void __iomem *buffers;
int nr_ports;
+ int tx_mask;
struct pci_dev *dev;
struct atm_dev *atmdev[4];
struct tasklet_struct tlet;
@@ -590,15 +591,13 @@ void solos_bh(unsigned long card_arg)
struct solos_card *card = (void *)card_arg;
int port;
uint32_t card_flags;
- uint32_t tx_mask;
uint32_t rx_done = 0;
card_flags = ioread32(card->config_regs + FLAGS_ADDR);
/* The TX bits are set if the channel is busy; clear if not. We want to
invoke fpga_tx() unless _all_ the bits for active channels are set */
- tx_mask = (1 << card->nr_ports) - 1;
- if ((card_flags & tx_mask) != tx_mask)
+ if ((card_flags & card->tx_mask) != card->tx_mask)
fpga_tx(card);
for (port = 0; port < card->nr_ports; port++) {
@@ -887,15 +886,20 @@ static void fpga_queue(struct solos_card *card, int port, struct sk_buff *skb,
struct atm_vcc *vcc)
{
int old_len;
+ unsigned long flags;
SKB_CB(skb)->vcc = vcc;
- spin_lock(&card->tx_queue_lock);
+ spin_lock_irqsave(&card->tx_queue_lock, flags);
old_len = skb_queue_len(&card->tx_queue[port]);
skb_queue_tail(&card->tx_queue[port], skb);
- spin_unlock(&card->tx_queue_lock);
+ if (!old_len) {
+ card->tx_mask |= (1 << port);
+ }
+ spin_unlock_irqrestore(&card->tx_queue_lock, flags);
- /* If TX might need to be started, do so */
+ /* Theoretically we could just schedule the tasklet here, but
+ that introduces latency we don't want -- it's noticeable */
if (!old_len)
fpga_tx(card);
}
@@ -911,7 +915,7 @@ static int fpga_tx(struct solos_card *card)
spin_lock_irqsave(&card->tx_lock, flags);
...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 2dca5ff..b7d4af3 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1166,6 +1166,8 @@ static void atm_remove(struct solos_card *card)
for (i = 0; i < card->nr_ports; i++) {
if (card->atmdev[i]) {
dev_info(&card->dev->dev, "Unregistering ATM device %d\n", card->atmdev[i]->number);
+
+ sysfs_remove_group(&card->atmdev[i]->class_dev.kobj, &solos_attr_group);
atm_dev_deregister(card->atmdev[i]);
}
}
--
1.6.0.6
--
There are still a _lot_ of attributes, but for at least the basic ones
we want to be able to get/set them from the kernel. Especially the ones
we want to inform the ATM core about (link state, speed).
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 187 insertions(+), 0 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 5179dbf..d9262a4 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -38,6 +38,8 @@
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/firmware.h>
+#include <linux/ctype.h>
+#include <linux/swab.h>
#define VERSION "0.07"
#define PTAG "solos-pci"
@@ -91,11 +93,23 @@ struct solos_card {
spinlock_t tx_lock;
spinlock_t tx_queue_lock;
spinlock_t cli_queue_lock;
+ spinlock_t param_queue_lock;
+ struct list_head param_queue;
struct sk_buff_head tx_queue[4];
struct sk_buff_head cli_queue[4];
+ wait_queue_head_t param_wq;
wait_queue_head_t fw_wq;
};
+
+struct solos_param {
+ struct list_head list;
+ pid_t pid;
+ int port;
+ struct sk_buff *response;
+ wait_queue_head_t wq;
+};
+
#define SOLOS_CHAN(atmdev) ((int)(unsigned long)(atmdev)->phy_data)
MODULE_AUTHOR("Traverse Technologies <support@traverse.com.au>");
@@ -131,6 +145,168 @@ static inline void solos_pop(struct atm_vcc *vcc, struct sk_buff *skb)
dev_kfree_skb_any(skb);
}
+static ssize_t solos_param_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
+ struct solos_card *card = atmdev->dev_data;
+ struct solos_param prm;
+ struct sk_buff *skb;
+ struct pkt_hdr *header;
+ int buflen;
+
+ buflen = strlen(attr->attr.name) + 10;
+
+ skb = alloc_skb(buflen, GFP_KERNEL);
+ if (!skb) {
+ dev_warn(&card->dev->dev, "Failed to allocate sk_buff in ...On Tue, 17 Mar 2009 21:29:15 +0000 Since these are generic, please use some form of netlink for this instead of sysfs. Bonding was the first mistake (trying to use sysfs for a transactional API). Pls don't repeat the mistake. --
It's not a transactional API. The sysfs model actually fits the communication with the hardware almost perfectly -- there are a bunch of named parameters, all of which can be read and a few of which can be written to. A sysfs read or write translates directly into a single exchange with the device's firmware. -- David Woodhouse Open Source Technology Centre David.Woodhouse@intel.com Intel Corporation --
From: David Woodhouse <dwmw2@infradead.org> Fair enough, I'll pull this into net-next-2.6 --
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index c289b62..b500f00 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -732,6 +732,12 @@ static int popen(struct atm_vcc *vcc)
struct sk_buff *skb;
struct pkt_hdr *header;
+ if (vcc->qos.aal != ATM_AAL5) {
+ dev_warn(&card->dev->dev, "Unsupported ATM type %d\n",
+ vcc->qos.aal);
+ return -EINVAL;
+ }
+
skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
if (!skb && net_ratelimit()) {
dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n");
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index f2736dd..8121f85 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -123,7 +123,6 @@ struct solos_param {
pid_t pid;
int port;
struct sk_buff *response;
- wait_queue_head_t wq;
};
#define SOLOS_CHAN(atmdev) ((int)(unsigned long)(atmdev)->phy_data)
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index df01682..7c26bd2 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1090,8 +1090,6 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
iowrite32(0, card->config_regs + FPGA_MODE);
data32 = ioread32(card->config_regs + FPGA_MODE);
}
- //Set RX empty flags
- iowrite32(0xF0, card->config_regs + FLAGS_ADDR);
data32 = ioread32(card->config_regs + FPGA_VER);
fpga_ver = (data32 & 0x0000FFFF);
@@ -1102,6 +1100,10 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (fpga_ver > 27)
card->using_dma = 1;
+ else {
+ /* Set RX empty flag for all ports */
+ iowrite32(0xF0, card->config_regs + FLAGS_ADDR);
+ }
card->nr_ports = 2; /* FIXME: Detect daughterboard */
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 6fe8f8f..bc3079d 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1097,7 +1097,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
dev_info(&dev->dev, "Solos FPGA Version %d.%02d svn-%d\n",
major_ver, minor_ver, fpga_ver);
- if (fpga_ver > 27)
+ if (0 && fpga_ver > 27)
card->using_dma = 1;
else {
/* Set RX empty flag for all ports */
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 53 ++++++++++++++++++++++++----------------------
1 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 5e228a3..e7691b3 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -140,7 +140,7 @@ module_param(fpga_upgrade, int, 0444);
static void fpga_queue(struct solos_card *card, int port, struct sk_buff *skb,
struct atm_vcc *vcc);
-static int fpga_tx(struct solos_card *);
+static uint32_t fpga_tx(struct solos_card *);
static irqreturn_t solos_irq(int irq, void *dev_id);
static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
static int list_vccs(int vci);
@@ -438,8 +438,6 @@ static int send_command(struct solos_card *card, int dev, const char *buf, size_
struct sk_buff *skb;
struct pkt_hdr *header;
-// dev_dbg(&card->dev->dev, "size: %d\n", size);
-
if (size > (BUF_SIZE - sizeof(*header))) {
dev_dbg(&card->dev->dev, "Command is too big. Dropping request\n");
return 0;
@@ -574,9 +572,9 @@ static irqreturn_t solos_irq(int irq, void *dev_id)
struct solos_card *card = dev_id;
int handled = 1;
- //ACK IRQ
iowrite32(0, card->config_regs + IRQ_CLEAR);
+ /* If we're up and running, just kick the tasklet to process TX/RX */
if (card->atmdev[0])
tasklet_schedule(&card->tlet);
else
@@ -588,16 +586,16 @@ static irqreturn_t solos_irq(int irq, void *dev_id)
void solos_bh(unsigned long card_arg)
{
struct solos_card *card = (void *)card_arg;
- int port;
uint32_t card_flags;
uint32_t rx_done = 0;
+ int port;
- card_flags = ioread32(card->config_regs + FLAGS_ADDR);
-
- /* The TX bits are set if the channel is busy; clear if not. We want to
- invoke fpga_tx() unless _all_ the bits for active channels are set */
- if ((card_flags & card->tx_mask) != card->tx_mask)
- fpga_tx(card);
+ /*
+ * Since fpga_tx() is going to need to ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index eef920a..1ff7304 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1206,10 +1206,28 @@ static void atm_remove(struct solos_card *card)
for (i = 0; i < card->nr_ports; i++) {
if (card->atmdev[i]) {
+ struct sk_buff *skb;
+
dev_info(&card->dev->dev, "Unregistering ATM device %d\n", card->atmdev[i]->number);
sysfs_remove_group(&card->atmdev[i]->class_dev.kobj, &solos_attr_group);
atm_dev_deregister(card->atmdev[i]);
+
+ skb = card->rx_skb[i];
+ if (skb) {
+ pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
+ RX_DMA_SIZE, PCI_DMA_FROMDEVICE);
+ dev_kfree_skb(skb);
+ }
+ skb = card->tx_skb[i];
+ if (skb) {
+ pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
+ skb->len, PCI_DMA_TODEVICE);
+ dev_kfree_skb(skb);
+ }
+ while ((skb = skb_dequeue(&card->tx_queue[i])))
+ dev_kfree_skb(skb);
+
}
}
}
@@ -1217,13 +1235,23 @@ static void atm_remove(struct solos_card *card)
static void fpga_remove(struct pci_dev *dev)
{
struct solos_card *card = pci_get_drvdata(dev);
+
+ /* Disable IRQs */
+ iowrite32(0, card->config_regs + IRQ_EN_ADDR);
+
+ /* Reset FPGA */
+ iowrite32(1, card->config_regs + FPGA_MODE);
+ (void)ioread32(card->config_regs + FPGA_MODE);
atm_remove(card);
- iowrite32(0, card->config_regs + IRQ_EN_ADDR);
free_irq(dev->irq, card);
tasklet_kill(&card->tlet);
+ /* Release device from reset */
+ iowrite32(0, card->config_regs + FPGA_MODE);
+ (void)ioread32(card->config_regs + FPGA_MODE);
+
pci_iounmap(dev, card->buffers);
pci_iounmap(dev, card->config_regs);
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 51 +++++++++++++++++++++++------------------------
1 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 7c26bd2..eef920a 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -314,14 +314,16 @@ static char *next_string(struct sk_buff *skb)
* for the information therein. Fields are....
*
* packet version
- * TxBitRate (version >= 1)
* RxBitRate (version >= 1)
+ * TxBitRate (version >= 1)
* State (version >= 1)
+ * LocalSNRMargin (version >= 1)
+ * LocalLineAttn (version >= 1)
*/
static int process_status(struct solos_card *card, int port, struct sk_buff *skb)
{
- char *str, *end, *state_str;
- int ver, rate_up, rate_down, state;
+ char *str, *end, *state_str, *snr, *attn;
+ int ver, rate_up, rate_down;
if (!card->atmdev[port])
return -ENODEV;
@@ -346,45 +348,42 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
return 0;
}
- rate_up = simple_strtol(str, &end, 10);
+ rate_down = simple_strtol(str, &end, 10);
if (*end)
return -EIO;
str = next_string(skb);
if (!str)
return -EIO;
- rate_down = simple_strtol(str, &end, 10);
+ rate_up = simple_strtol(str, &end, 10);
if (*end)
return -EIO;
state_str = next_string(skb);
if (!state_str)
return -EIO;
- if (!strcmp(state_str, "Showtime"))
- state = ATM_PHY_SIG_FOUND;
- else {
- state = ATM_PHY_SIG_LOST;
+
+ /* Anything but 'Showtime' is down */
+ if (strcmp(state_str, "Showtime")) {
+ card->atmdev[port]->signal = ATM_PHY_SIG_LOST;
release_vccs(card->atmdev[port]);
+ dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
+ return 0;
}
- if (state == ATM_PHY_SIG_LOST) {
- dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
- } else {
- char *snr, *attn;
-
- snr = ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 21c73b1..c54eceb 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -70,6 +70,7 @@
#define RX_DMA_SIZE 2048
+static int reset = 0;
static int atmdebug = 0;
static int firmware_upgrade = 0;
static int fpga_upgrade = 0;
@@ -131,9 +132,11 @@ MODULE_AUTHOR("Traverse Technologies <support@traverse.com.au>");
MODULE_DESCRIPTION("Solos PCI driver");
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
+MODULE_PARM_DESC(reset, "Reset Solos chips on startup");
MODULE_PARM_DESC(atmdebug, "Print ATM data");
MODULE_PARM_DESC(firmware_upgrade, "Initiate Solos firmware upgrade");
MODULE_PARM_DESC(fpga_upgrade, "Initiate FPGA upgrade");
+module_param(reset, int, 0444);
module_param(atmdebug, int, 0644);
module_param(firmware_upgrade, int, 0444);
module_param(fpga_upgrade, int, 0444);
@@ -1071,6 +1074,13 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
goto out_unmap_config;
}
+ if (reset) {
+ iowrite32(1, card->config_regs + FPGA_MODE);
+ data32 = ioread32(card->config_regs + FPGA_MODE);
+
+ iowrite32(0, card->config_regs + FPGA_MODE);
+ data32 = ioread32(card->config_regs + FPGA_MODE);
+ }
//Fill Config Mem with zeros
for(i = 0; i < 128; i += 4)
iowrite32(0, card->config_regs + i);
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index b500f00..2978699 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -303,8 +303,8 @@ static char *next_string(struct sk_buff *skb)
*/
static int process_status(struct solos_card *card, int port, struct sk_buff *skb)
{
- char *str, *end;
- int ver, rate_up, rate_down, state;
+ char *str, *end, *state_str;
+ int ver, rate_up, rate_down, state, snr, attn;
if (!card->atmdev[port])
return -ENODEV;
@@ -330,19 +330,35 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
if (*end)
return -EIO;
- str = next_string(skb);
- if (!strcmp(str, "Showtime"))
+ state_str = next_string(skb);
+ if (!strcmp(state_str, "Showtime"))
state = ATM_PHY_SIG_FOUND;
else {
state = ATM_PHY_SIG_LOST;
release_vccs(card->atmdev[port]);
}
+ str = next_string(skb);
+ snr = simple_strtol(str, &end, 10);
+ if (*end)
+ return -EIO;
+
+ str = next_string(skb);
+ attn = simple_strtol(str, &end, 10);
+ if (*end)
+ return -EIO;
+
+ if (state == ATM_PHY_SIG_LOST && !rate_up && !rate_down)
+ dev_info(&card->dev->dev, "Port %d ATM state: %s\n",
+ port, state_str);
+ else
+ dev_info(&card->dev->dev, "Port %d ATM state: %s (%d/%d kb/s, SNR %ddB, Attn %ddB)\n",
+ port, state_str, rate_up/1000, rate_down/1000,
+ snr, attn);
+
card->atmdev[port]->link_rate = rate_down;
card->atmdev[port]->signal = state;
- dev_info(&card->dev->dev, "ATM state: '%s', %d/%d kb/s up/down.\n",
- str, rate_up/1000, rate_down/1000);
return 0;
}
@@ -851,7 +867,7 @@ static int fpga_tx(struct solos_card *card)
dev_vdbg(&card->dev->dev, "TX Flags are %X\n", tx_pending);
for (port = 0; port < card->nr_ports; port++) {
- if (!(tx_pending & (1 << port))) ...Neither of these are necessary.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 2ef8157..f2736dd 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -570,16 +570,12 @@ static irqreturn_t solos_irq(int irq, void *dev_id)
//ACK IRQ
iowrite32(0, card->config_regs + IRQ_CLEAR);
- //Disable IRQs from FPGA
- iowrite32(0, card->config_regs + IRQ_EN_ADDR);
if (card->atmdev[0])
tasklet_schedule(&card->tlet);
else
wake_up(&card->fw_wq);
- //Enable IRQs from FPGA
- iowrite32(1, card->config_regs + IRQ_EN_ADDR);
return IRQ_RETVAL(handled);
}
@@ -1132,7 +1128,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
}
*/
//dev_dbg(&card->dev->dev, "Requesting IRQ: %d\n",dev->irq);
- err = request_irq(dev->irq, solos_irq, IRQF_DISABLED|IRQF_SHARED,
+ err = request_irq(dev->irq, solos_irq, IRQF_SHARED,
"solos-pci", card);
if (err) {
dev_dbg(&card->dev->dev, "Failed to request interrupt IRQ: %d\n", dev->irq);
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index c54eceb..f27bd92 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -340,6 +340,12 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
str = next_string(skb);
if (!str)
return -EIO;
+ if (!strcmp(str, "ERROR")) {
+ dev_dbg(&card->dev->dev, "Status packet indicated Solos error on port %d (starting up?)\n",
+ port);
+ return 0;
+ }
+
rate_up = simple_strtol(str, &end, 10);
if (*end)
return -EIO;
@@ -362,8 +368,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
}
if (state == ATM_PHY_SIG_LOST) {
- dev_info(&card->dev->dev, "Port %d ATM state: %s\n",
- port, state_str);
+ dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
} else {
char *snr, *attn;
@@ -374,7 +379,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
if (!attn)
return -EIO;
- dev_info(&card->dev->dev, "Port %d: %s (%d/%d kb/s%s%s%s%s)\n",
+ dev_info(&card->dev->dev, "Port %d: %s @%d/%d kb/s%s%s%s%s\n",
port, state_str, rate_down/1000, rate_up/1000,
snr[0]?", SNR ":"", snr, attn[0]?", Attn ":"", attn);
}
@@ -663,7 +668,11 @@ void solos_bh(unsigned long card_arg)
break;
case PKT_STATUS:
- process_status(card, port, skb);
+ if (process_status(card, port, skb) &&
+ net_ratelimit()) {
+ dev_warn(&card->dev->dev, "Bad status packet of %d bytes on port %d:\n", skb->len, port);
+ print_buffer(skb);
+ }
dev_kfree_skb_any(skb);
break;
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index f27bd92..df01682 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1040,7 +1040,7 @@ static struct atmdev_ops fpga_ops = {
static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
- int err, i;
+ int err;
uint16_t fpga_ver;
uint8_t major_ver, minor_ver;
uint32_t data32;
@@ -1090,10 +1090,6 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
iowrite32(0, card->config_regs + FPGA_MODE);
data32 = ioread32(card->config_regs + FPGA_MODE);
}
- //Fill Config Mem with zeros
- for(i = 0; i < 128; i += 4)
- iowrite32(0, card->config_regs + i);
-
//Set RX empty flags
iowrite32(0xF0, card->config_regs + FLAGS_ADDR);
--
1.6.0.6
--
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 23 -----------------------
1 files changed, 0 insertions(+), 23 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index bf59c40..2ef8157 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -70,7 +70,6 @@
#define RX_DMA_SIZE 2048
-static int debug = 0;
static int atmdebug = 0;
static int firmware_upgrade = 0;
static int fpga_upgrade = 0;
@@ -133,11 +132,9 @@ MODULE_AUTHOR("Traverse Technologies <support@traverse.com.au>");
MODULE_DESCRIPTION("Solos PCI driver");
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
-MODULE_PARM_DESC(debug, "Enable Loopback");
MODULE_PARM_DESC(atmdebug, "Print ATM data");
MODULE_PARM_DESC(firmware_upgrade, "Initiate Solos firmware upgrade");
MODULE_PARM_DESC(fpga_upgrade, "Initiate FPGA upgrade");
-module_param(debug, int, 0444);
module_param(atmdebug, int, 0644);
module_param(firmware_upgrade, int, 0444);
module_param(fpga_upgrade, int, 0444);
@@ -974,26 +971,12 @@ static int fpga_tx(struct solos_card *card)
static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
{
struct solos_card *card = vcc->dev->dev_data;
- struct sk_buff *skb2 = NULL;
struct pkt_hdr *header;
int pktlen;
//dev_dbg(&card->dev->dev, "psend called.\n");
//dev_dbg(&card->dev->dev, "dev,vpi,vci = %d,%d,%d\n",SOLOS_CHAN(vcc->dev),vcc->vpi,vcc->vci);
- if (debug) {
- skb2 = atm_alloc_charge(vcc, skb->len, GFP_ATOMIC);
- if (skb2) {
- memcpy(skb2->data, skb->data, skb->len);
- skb_put(skb2, skb->len);
- vcc->push(vcc, skb2);
- atomic_inc(&vcc->stats->rx);
- }
- atomic_inc(&vcc->stats->tx);
- solos_pop(vcc, skb);
- return 0;
- }
-
pktlen = skb->len;
if (pktlen > (BUF_SIZE - sizeof(*header))) {
dev_warn(&card->dev->dev, "Length of PDU is too large. Dropping PDU.\n");
@@ -1052,9 +1035,6 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
uint32_t ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 52 ++--------------------------------------------
1 files changed, 3 insertions(+), 49 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index e7691b3..21c73b1 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -813,8 +813,7 @@ static int popen(struct atm_vcc *vcc)
fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL);
-// dev_dbg(&card->dev->dev, "Open for vpi %d and vci %d on interface %d\n", vcc->vpi, vcc->vci, SOLOS_CHAN(vcc->dev));
- set_bit(ATM_VF_ADDR, &vcc->flags); // accept the vpi / vci
+ set_bit(ATM_VF_ADDR, &vcc->flags);
set_bit(ATM_VF_READY, &vcc->flags);
list_vccs(0);
@@ -842,8 +841,6 @@ static void pclose(struct atm_vcc *vcc)
fpga_queue(card, SOLOS_CHAN(vcc->dev), skb, NULL);
-// dev_dbg(&card->dev->dev, "Close for vpi %d and vci %d on interface %d\n", vcc->vpi, vcc->vci, SOLOS_CHAN(vcc->dev));
-
clear_bit(ATM_VF_ADDR, &vcc->flags);
clear_bit(ATM_VF_READY, &vcc->flags);
@@ -936,7 +933,7 @@ static uint32_t fpga_tx(struct solos_card *card)
if (skb && !card->using_dma) {
memcpy_toio(TX_BUF(card, port), skb->data, skb->len);
- tx_started |= 1 << port; //Set TX full flag
+ tx_started |= 1 << port;
oldskb = skb; /* We're done with this skb already */
} else if (skb && card->using_dma) {
SKB_CB(skb)->dma_addr = pci_map_single(card->dev, skb->data,
@@ -965,10 +962,10 @@ static uint32_t fpga_tx(struct solos_card *card)
}
}
+ /* For non-DMA TX, write the 'TX start' bit for all four ports simultaneously */
if (tx_started)
iowrite32(tx_started, card->config_regs + FLAGS_ADDR);
- out:
spin_unlock_irqrestore(&card->tx_lock, flags);
return card_flags;
}
@@ -979,9 +976,6 @@ static int psend(struct atm_vcc *vcc, struct sk_buff *skb)
struct pkt_hdr *header;
int pktlen;
- //dev_dbg(&card->dev->dev, "psend called.\n");
- //dev_dbg(&card->dev->dev, ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 118 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 90 insertions(+), 28 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index b7d4af3..63c9ad0 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -55,6 +55,8 @@
#define FLASH_BUSY 0x60
#define FPGA_MODE 0x5C
#define FLASH_MODE 0x58
+#define TX_DMA_ADDR(port) (0x40 + (4 * (port)))
+#define RX_DMA_ADDR(port) (0x30 + (4 * (port)))
#define DATA_RAM_SIZE 32768
#define BUF_SIZE 4096
@@ -78,6 +80,14 @@ struct pkt_hdr {
__le16 type;
};
+struct solos_skb_cb {
+ struct atm_vcc *vcc;
+ uint32_t dma_addr;
+};
+
+
+#define SKB_CB(skb) ((struct solos_skb_cb *)skb->cb)
+
#define PKT_DATA 0
#define PKT_COMMAND 1
#define PKT_POPEN 3
@@ -98,8 +108,11 @@ struct solos_card {
struct list_head param_queue;
struct sk_buff_head tx_queue[4];
struct sk_buff_head cli_queue[4];
+ struct sk_buff *tx_skb[4];
+ struct sk_buff *rx_skb[4];
wait_queue_head_t param_wq;
wait_queue_head_t fw_wq;
+ int using_dma;
};
@@ -588,44 +601,64 @@ void solos_bh(unsigned long card_arg)
for (port = 0; port < card->nr_ports; port++) {
if (card_flags & (0x10 << port)) {
- struct pkt_hdr header;
+ struct pkt_hdr _hdr, *header;
struct sk_buff *skb;
struct atm_vcc *vcc;
int size;
- rx_done |= 0x10 << port;
+ if (card->using_dma) {
+ skb = card->rx_skb[port];
+ pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr, skb->len,
+ PCI_DMA_FROMDEVICE);
+
+ card->rx_skb[port] = alloc_skb(2048, GFP_ATOMIC);
+ if (card->rx_skb[port]) {
+ SKB_CB(card->rx_skb[port])->dma_addr =
+ pci_map_single(card->dev, skb->data, skb->len,
+ PCI_DMA_FROMDEVICE);
+ iowrite32(SKB_CB(card->rx_skb[port])->dma_addr,
+ card->config_regs + RX_DMA_ADDR(port));
+ }
+ header = (void *)skb->data;
+ size = ...Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
drivers/atm/solos-pci.c | 95 ++++++++++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 42 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 63c9ad0..acba08d 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -68,6 +68,8 @@
#define RX_BUF(card, nr) ((card->buffers) + (nr)*BUF_SIZE*2)
#define TX_BUF(card, nr) ((card->buffers) + (nr)*BUF_SIZE*2 + BUF_SIZE)
+#define RX_DMA_SIZE 2048
+
static int debug = 0;
static int atmdebug = 0;
static int firmware_upgrade = 0;
@@ -608,17 +610,11 @@ void solos_bh(unsigned long card_arg)
if (card->using_dma) {
skb = card->rx_skb[port];
- pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr, skb->len,
- PCI_DMA_FROMDEVICE);
-
- card->rx_skb[port] = alloc_skb(2048, GFP_ATOMIC);
- if (card->rx_skb[port]) {
- SKB_CB(card->rx_skb[port])->dma_addr =
- pci_map_single(card->dev, skb->data, skb->len,
- PCI_DMA_FROMDEVICE);
- iowrite32(SKB_CB(card->rx_skb[port])->dma_addr,
- card->config_regs + RX_DMA_ADDR(port));
- }
+ card->rx_skb[port] = NULL;
+
+ pci_unmap_single(card->dev, SKB_CB(skb)->dma_addr,
+ RX_DMA_SIZE, PCI_DMA_FROMDEVICE);
+
header = (void *)skb->data;
size = le16_to_cpu(header->size);
skb_put(skb, size + sizeof(*header));
@@ -669,7 +665,7 @@ void solos_bh(unsigned long card_arg)
case PKT_STATUS:
process_status(card, port, skb);
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
break;
case PKT_COMMAND:
@@ -681,12 +677,32 @@ void solos_bh(unsigned long card_arg)
if (net_ratelimit())
dev_warn(&card->dev->dev, "Dropping console response on port %d\n",
port);
+ dev_kfree_skb_any(skb);
} else
skb_queue_tail(&card->cli_queue[port], skb);
spin_unlock(&card->cli_queue_lock);
break;
}
}
+ /* Allocate RX skbs for ...