aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm/solos-pci.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-01-27 18:22:57 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-01-27 18:22:57 -0500
commitaf7806560c972b5b8c79e9704d7816813343cbc1 (patch)
tree9638b2a26eff0c8a633a3ee9dfa2e730e1597df7 /drivers/atm/solos-pci.c
parentb28a4b9a38b9d75caceb4f554bfdbb7a413b2ad0 (diff)
solos: Add SNR and Attn to status packet, fix oops on load
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/atm/solos-pci.c')
-rw-r--r--drivers/atm/solos-pci.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index b500f00e184c..297869965fc4 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)
303 */ 303 */
304static int process_status(struct solos_card *card, int port, struct sk_buff *skb) 304static int process_status(struct solos_card *card, int port, struct sk_buff *skb)
305{ 305{
306 char *str, *end; 306 char *str, *end, *state_str;
307 int ver, rate_up, rate_down, state; 307 int ver, rate_up, rate_down, state, snr, attn;
308 308
309 if (!card->atmdev[port]) 309 if (!card->atmdev[port])
310 return -ENODEV; 310 return -ENODEV;
@@ -330,19 +330,35 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
330 if (*end) 330 if (*end)
331 return -EIO; 331 return -EIO;
332 332
333 str = next_string(skb); 333 state_str = next_string(skb);
334 if (!strcmp(str, "Showtime")) 334 if (!strcmp(state_str, "Showtime"))
335 state = ATM_PHY_SIG_FOUND; 335 state = ATM_PHY_SIG_FOUND;
336 else { 336 else {
337 state = ATM_PHY_SIG_LOST; 337 state = ATM_PHY_SIG_LOST;
338 release_vccs(card->atmdev[port]); 338 release_vccs(card->atmdev[port]);
339 } 339 }
340 340
341 str = next_string(skb);
342 snr = simple_strtol(str, &end, 10);
343 if (*end)
344 return -EIO;
345
346 str = next_string(skb);
347 attn = simple_strtol(str, &end, 10);
348 if (*end)
349 return -EIO;
350
351 if (state == ATM_PHY_SIG_LOST && !rate_up && !rate_down)
352 dev_info(&card->dev->dev, "Port %d ATM state: %s\n",
353 port, state_str);
354 else
355 dev_info(&card->dev->dev, "Port %d ATM state: %s (%d/%d kb/s, SNR %ddB, Attn %ddB)\n",
356 port, state_str, rate_up/1000, rate_down/1000,
357 snr, attn);
358
341 card->atmdev[port]->link_rate = rate_down; 359 card->atmdev[port]->link_rate = rate_down;
342 card->atmdev[port]->signal = state; 360 card->atmdev[port]->signal = state;
343 361
344 dev_info(&card->dev->dev, "ATM state: '%s', %d/%d kb/s up/down.\n",
345 str, rate_up/1000, rate_down/1000);
346 return 0; 362 return 0;
347} 363}
348 364
@@ -851,7 +867,7 @@ static int fpga_tx(struct solos_card *card)
851 dev_vdbg(&card->dev->dev, "TX Flags are %X\n", tx_pending); 867 dev_vdbg(&card->dev->dev, "TX Flags are %X\n", tx_pending);
852 868
853 for (port = 0; port < card->nr_ports; port++) { 869 for (port = 0; port < card->nr_ports; port++) {
854 if (!(tx_pending & (1 << port))) { 870 if (card->atmdev[port] && !(tx_pending & (1 << port))) {
855 871
856 spin_lock(&card->tx_queue_lock); 872 spin_lock(&card->tx_queue_lock);
857 skb = skb_dequeue(&card->tx_queue[port]); 873 skb = skb_dequeue(&card->tx_queue[port]);