solos: various upstreamed solos patches
authorFelix Fietkau <nbd@openwrt.org>
Tue, 12 Apr 2011 19:50:15 +0000 (19:50 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 12 Apr 2011 19:50:15 +0000 (19:50 +0000)
These patches were submitted to netdev and will likely be out in 2.6.38.3.
In the meantime, they're needed in 2.6.37.6.
Patch by Philip Prindeville

SVN-Revision: 26616

target/linux/generic/patches-2.6.37/282-solos-debug_skbuff.patch [new file with mode: 0644]
target/linux/generic/patches-2.6.37/283-solos-vccs_release.patch [new file with mode: 0644]

diff --git a/target/linux/generic/patches-2.6.37/282-solos-debug_skbuff.patch b/target/linux/generic/patches-2.6.37/282-solos-debug_skbuff.patch
new file mode 100644 (file)
index 0000000..837057e
--- /dev/null
@@ -0,0 +1,51 @@
+commit 18b429e74eeafe42e947b1b0f9a760c7153a0b5c
+Author: Philip A. Prindeville <philipp@redfish-solutions.com>
+Date:   Wed Mar 30 12:59:26 2011 +0000
+
+    atm/solos-pci: Don't include frame pseudo-header on transmit hex-dump
+    
+    Omit pkt_hdr preamble when dumping transmitted packet as hex-dump;
+    we can pull this up because the frame has already been sent, and
+    dumping it is the last thing we do with it before freeing it.
+    
+    Also include the size, vpi, and vci in the debug as is done on
+    receive.
+    
+    Use "port" consistently instead of "device" intermittently.
+    
+    Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
+    Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/atm/solos-pci.c |    9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
+index 2c4146a..968f022 100644
+--- a/drivers/atm/solos-pci.c
++++ b/drivers/atm/solos-pci.c
+@@ -697,7 +697,7 @@ void solos_bh(unsigned long card_arg)
+                                             size);
+                       }
+                       if (atmdebug) {
+-                              dev_info(&card->dev->dev, "Received: device %d\n", port);
++                              dev_info(&card->dev->dev, "Received: port %d\n", port);
+                               dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
+                                        size, le16_to_cpu(header->vpi),
+                                        le16_to_cpu(header->vci));
+@@ -1018,8 +1018,15 @@ static uint32_t fpga_tx(struct solos_card *card)
+                       /* Clean up and free oldskb now it's gone */
+                       if (atmdebug) {
++                              struct pkt_hdr *header = (void *)oldskb->data;
++                              int size = le16_to_cpu(header->size);
++
++                              skb_pull(oldskb, sizeof(*header));
+                               dev_info(&card->dev->dev, "Transmitted: port %d\n",
+                                        port);
++                              dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
++                                       size, le16_to_cpu(header->vpi),
++                                       le16_to_cpu(header->vci));
+                               print_buffer(oldskb);
+                       }
+
diff --git a/target/linux/generic/patches-2.6.37/283-solos-vccs_release.patch b/target/linux/generic/patches-2.6.37/283-solos-vccs_release.patch
new file mode 100644 (file)
index 0000000..8894fc4
--- /dev/null
@@ -0,0 +1,107 @@
+commit c031235b395433350f25943b7580a5e343c7b7b2
+Author: Philip A. Prindeville <philipp@redfish-solutions.com>
+Date:   Wed Mar 30 13:17:04 2011 +0000
+
+    atm/solos-pci: Don't flap VCs when carrier state changes
+    
+    Don't flap VCs when carrier state changes; higher-level protocols
+    can detect loss of connectivity and act accordingly. This is more
+    consistent with how other network interfaces work.
+    
+    We no longer use release_vccs() so we can delete it.
+    
+    release_vccs() was duplicated from net/atm/common.c; make the
+    corresponding function exported, since other code duplicates it
+    and could leverage it if it were public.
+    
+    Signed-off-by: Philip A. Prindeville <philipp@redfish-solutions.com>
+    Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/atm/solos-pci.c |   26 +-------------------------
+ include/linux/atmdev.h  |    1 +
+ net/atm/common.c        |    1 +
+ 3 files changed, 3 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
+index 968f022..cd0ff66 100644
+--- a/drivers/atm/solos-pci.c
++++ b/drivers/atm/solos-pci.c
+@@ -165,7 +165,6 @@ 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);
+-static void release_vccs(struct atm_dev *dev);
+ static int atm_init(struct solos_card *, struct device *);
+ static void atm_remove(struct solos_card *);
+ static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
+@@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
+       /* Anything but 'Showtime' is down */
+       if (strcmp(state_str, "Showtime")) {
+               atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST);
+-              release_vccs(card->atmdev[port]);
+               dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
+               return 0;
+       }
+@@ -830,28 +828,6 @@ 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) {
+-                                vcc_release_async(vcc, -EPIPE);
+-                                sk_del_node_init(s);
+-                        }
+-                }
+-        }
+-        write_unlock_irq(&vcc_sklist_lock);
+-}
+-
+ static int popen(struct atm_vcc *vcc)
+ {
+@@ -1269,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent)
+               card->atmdev[i]->ci_range.vci_bits = 16;
+               card->atmdev[i]->dev_data = card;
+               card->atmdev[i]->phy_data = (void *)(unsigned long)i;
+-              atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN);
++              atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND);
+               skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
+               if (!skb) {
+diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
+index 475f8c4..381f4ce 100644
+--- a/include/linux/atmdev.h
++++ b/include/linux/atmdev.h
+@@ -443,6 +443,7 @@ void atm_dev_signal_change(struct atm_dev *dev, char signal);
+ void vcc_insert_socket(struct sock *sk);
++void atm_dev_release_vccs(struct atm_dev *dev);
+ /*
+  * This is approximately the algorithm used by alloc_skb.
+diff --git a/net/atm/common.c b/net/atm/common.c
+index 1b9c52a..22b963d 100644
+--- a/net/atm/common.c
++++ b/net/atm/common.c
+@@ -252,6 +252,7 @@ void atm_dev_release_vccs(struct atm_dev *dev)
+       }
+       write_unlock_irq(&vcc_sklist_lock);
+ }
++EXPORT_SYMBOL(atm_dev_release_vccs);
+ static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
+ {
+