diff options
author | Karsten Keil <isdn@linux-pingi.de> | 2012-05-04 00:15:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-04 11:56:19 -0400 |
commit | f45ebf3a6be9da051f078b30e7309b6788932189 (patch) | |
tree | 539bb636aec1ec8542218c54866f724b39164182 /drivers/isdn | |
parent | 1ea52fbda1629216182a0b0fbee9d65e8bcedd1e (diff) |
mISDN: Help to identify the card
With multiple cards is hard to figure out which port caused trouble
int the layer2 routines (e.g. got a timeout).
Now we have the informations in the log output.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/mISDN/core.c | 16 | ||||
-rw-r--r-- | drivers/isdn/mISDN/layer2.c | 76 |
2 files changed, 60 insertions, 32 deletions
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c index a24530f05db0..c401634c00ec 100644 --- a/drivers/isdn/mISDN/core.c +++ b/drivers/isdn/mISDN/core.c | |||
@@ -355,6 +355,22 @@ mISDN_unregister_Bprotocol(struct Bprotocol *bp) | |||
355 | } | 355 | } |
356 | EXPORT_SYMBOL(mISDN_unregister_Bprotocol); | 356 | EXPORT_SYMBOL(mISDN_unregister_Bprotocol); |
357 | 357 | ||
358 | static const char *msg_no_channel = "<no channel>"; | ||
359 | static const char *msg_no_stack = "<no stack>"; | ||
360 | static const char *msg_no_stackdev = "<no stack device>"; | ||
361 | |||
362 | const char *mISDNDevName4ch(struct mISDNchannel *ch) | ||
363 | { | ||
364 | if (!ch) | ||
365 | return msg_no_channel; | ||
366 | if (!ch->st) | ||
367 | return msg_no_stack; | ||
368 | if (!ch->st->dev) | ||
369 | return msg_no_stackdev; | ||
370 | return dev_name(&ch->st->dev->dev); | ||
371 | }; | ||
372 | EXPORT_SYMBOL(mISDNDevName4ch); | ||
373 | |||
358 | static int | 374 | static int |
359 | mISDNInit(void) | 375 | mISDNInit(void) |
360 | { | 376 | { |
diff --git a/drivers/isdn/mISDN/layer2.c b/drivers/isdn/mISDN/layer2.c index b6fbaec1d612..0dc8abca1407 100644 --- a/drivers/isdn/mISDN/layer2.c +++ b/drivers/isdn/mISDN/layer2.c | |||
@@ -110,8 +110,8 @@ l2m_debug(struct FsmInst *fi, char *fmt, ...) | |||
110 | vaf.fmt = fmt; | 110 | vaf.fmt = fmt; |
111 | vaf.va = &va; | 111 | vaf.va = &va; |
112 | 112 | ||
113 | printk(KERN_DEBUG "l2 (sapi %d tei %d): %pV\n", | 113 | printk(KERN_DEBUG "%s l2 (sapi %d tei %d): %pV\n", |
114 | l2->sapi, l2->tei, &vaf); | 114 | mISDNDevName4ch(&l2->ch), l2->sapi, l2->tei, &vaf); |
115 | 115 | ||
116 | va_end(va); | 116 | va_end(va); |
117 | } | 117 | } |
@@ -154,7 +154,8 @@ l2up(struct layer2 *l2, u_int prim, struct sk_buff *skb) | |||
154 | mISDN_HEAD_ID(skb) = (l2->ch.nr << 16) | l2->ch.addr; | 154 | mISDN_HEAD_ID(skb) = (l2->ch.nr << 16) | l2->ch.addr; |
155 | err = l2->up->send(l2->up, skb); | 155 | err = l2->up->send(l2->up, skb); |
156 | if (err) { | 156 | if (err) { |
157 | printk(KERN_WARNING "%s: err=%d\n", __func__, err); | 157 | printk(KERN_WARNING "%s: dev %s err=%d\n", __func__, |
158 | mISDNDevName4ch(&l2->ch), err); | ||
158 | dev_kfree_skb(skb); | 159 | dev_kfree_skb(skb); |
159 | } | 160 | } |
160 | } | 161 | } |
@@ -178,7 +179,8 @@ l2up_create(struct layer2 *l2, u_int prim, int len, void *arg) | |||
178 | memcpy(skb_put(skb, len), arg, len); | 179 | memcpy(skb_put(skb, len), arg, len); |
179 | err = l2->up->send(l2->up, skb); | 180 | err = l2->up->send(l2->up, skb); |
180 | if (err) { | 181 | if (err) { |
181 | printk(KERN_WARNING "%s: err=%d\n", __func__, err); | 182 | printk(KERN_WARNING "%s: dev %s err=%d\n", __func__, |
183 | mISDNDevName4ch(&l2->ch), err); | ||
182 | dev_kfree_skb(skb); | 184 | dev_kfree_skb(skb); |
183 | } | 185 | } |
184 | } | 186 | } |
@@ -189,7 +191,8 @@ l2down_skb(struct layer2 *l2, struct sk_buff *skb) { | |||
189 | 191 | ||
190 | ret = l2->ch.recv(l2->ch.peer, skb); | 192 | ret = l2->ch.recv(l2->ch.peer, skb); |
191 | if (ret && (*debug & DEBUG_L2_RECV)) | 193 | if (ret && (*debug & DEBUG_L2_RECV)) |
192 | printk(KERN_DEBUG "l2down_skb: ret(%d)\n", ret); | 194 | printk(KERN_DEBUG "l2down_skb: dev %s ret(%d)\n", |
195 | mISDNDevName4ch(&l2->ch), ret); | ||
193 | return ret; | 196 | return ret; |
194 | } | 197 | } |
195 | 198 | ||
@@ -289,18 +292,18 @@ l2_timeout(struct FsmInst *fi, int event, void *arg) | |||
289 | 292 | ||
290 | skb = mI_alloc_skb(0, GFP_ATOMIC); | 293 | skb = mI_alloc_skb(0, GFP_ATOMIC); |
291 | if (!skb) { | 294 | if (!skb) { |
292 | printk(KERN_WARNING "L2(%d,%d) nr:%x timer %s lost - no skb\n", | 295 | printk(KERN_WARNING "%s: L2(%d,%d) nr:%x timer %s no skb\n", |
293 | l2->sapi, l2->tei, l2->ch.nr, event == EV_L2_T200 ? | 296 | mISDNDevName4ch(&l2->ch), l2->sapi, l2->tei, |
294 | "T200" : "T203"); | 297 | l2->ch.nr, event == EV_L2_T200 ? "T200" : "T203"); |
295 | return; | 298 | return; |
296 | } | 299 | } |
297 | hh = mISDN_HEAD_P(skb); | 300 | hh = mISDN_HEAD_P(skb); |
298 | hh->prim = event == EV_L2_T200 ? DL_TIMER200_IND : DL_TIMER203_IND; | 301 | hh->prim = event == EV_L2_T200 ? DL_TIMER200_IND : DL_TIMER203_IND; |
299 | hh->id = l2->ch.nr; | 302 | hh->id = l2->ch.nr; |
300 | if (*debug & DEBUG_TIMER) | 303 | if (*debug & DEBUG_TIMER) |
301 | printk(KERN_DEBUG "L2(%d,%d) nr:%x timer %s expired\n", | 304 | printk(KERN_DEBUG "%s: L2(%d,%d) nr:%x timer %s expired\n", |
302 | l2->sapi, l2->tei, l2->ch.nr, event == EV_L2_T200 ? | 305 | mISDNDevName4ch(&l2->ch), l2->sapi, l2->tei, |
303 | "T200" : "T203"); | 306 | l2->ch.nr, event == EV_L2_T200 ? "T200" : "T203"); |
304 | if (l2->ch.st) | 307 | if (l2->ch.st) |
305 | l2->ch.st->own.recv(&l2->ch.st->own, skb); | 308 | l2->ch.st->own.recv(&l2->ch.st->own, skb); |
306 | } | 309 | } |
@@ -309,8 +312,8 @@ static int | |||
309 | l2mgr(struct layer2 *l2, u_int prim, void *arg) { | 312 | l2mgr(struct layer2 *l2, u_int prim, void *arg) { |
310 | long c = (long)arg; | 313 | long c = (long)arg; |
311 | 314 | ||
312 | printk(KERN_WARNING | 315 | printk(KERN_WARNING "l2mgr: dev %s addr:%x prim %x %c\n", |
313 | "l2mgr: addr:%x prim %x %c\n", l2->id, prim, (char)c); | 316 | mISDNDevName4ch(&l2->ch), l2->id, prim, (char)c); |
314 | if (test_bit(FLG_LAPD, &l2->flag) && | 317 | if (test_bit(FLG_LAPD, &l2->flag) && |
315 | !test_bit(FLG_FIXED_TEI, &l2->flag)) { | 318 | !test_bit(FLG_FIXED_TEI, &l2->flag)) { |
316 | switch (c) { | 319 | switch (c) { |
@@ -632,8 +635,8 @@ send_uframe(struct layer2 *l2, struct sk_buff *skb, u_char cmd, u_char cr) | |||
632 | else { | 635 | else { |
633 | skb = mI_alloc_skb(i, GFP_ATOMIC); | 636 | skb = mI_alloc_skb(i, GFP_ATOMIC); |
634 | if (!skb) { | 637 | if (!skb) { |
635 | printk(KERN_WARNING "%s: can't alloc skbuff\n", | 638 | printk(KERN_WARNING "%s: can't alloc skbuff in %s\n", |
636 | __func__); | 639 | mISDNDevName4ch(&l2->ch), __func__); |
637 | return; | 640 | return; |
638 | } | 641 | } |
639 | } | 642 | } |
@@ -1118,8 +1121,8 @@ enquiry_cr(struct layer2 *l2, u_char typ, u_char cr, u_char pf) | |||
1118 | tmp[i++] = (l2->vr << 5) | typ | (pf ? 0x10 : 0); | 1121 | tmp[i++] = (l2->vr << 5) | typ | (pf ? 0x10 : 0); |
1119 | skb = mI_alloc_skb(i, GFP_ATOMIC); | 1122 | skb = mI_alloc_skb(i, GFP_ATOMIC); |
1120 | if (!skb) { | 1123 | if (!skb) { |
1121 | printk(KERN_WARNING | 1124 | printk(KERN_WARNING "%s: isdnl2 can't alloc sbbuff in %s\n", |
1122 | "isdnl2 can't alloc sbbuff for enquiry_cr\n"); | 1125 | mISDNDevName4ch(&l2->ch), __func__); |
1123 | return; | 1126 | return; |
1124 | } | 1127 | } |
1125 | memcpy(skb_put(skb, i), tmp, i); | 1128 | memcpy(skb_put(skb, i), tmp, i); |
@@ -1179,7 +1182,7 @@ invoke_retransmission(struct layer2 *l2, unsigned int nr) | |||
1179 | else | 1182 | else |
1180 | printk(KERN_WARNING | 1183 | printk(KERN_WARNING |
1181 | "%s: windowar[%d] is NULL\n", | 1184 | "%s: windowar[%d] is NULL\n", |
1182 | __func__, p1); | 1185 | mISDNDevName4ch(&l2->ch), p1); |
1183 | l2->windowar[p1] = NULL; | 1186 | l2->windowar[p1] = NULL; |
1184 | } | 1187 | } |
1185 | mISDN_FsmEvent(&l2->l2m, EV_L2_ACK_PULL, NULL); | 1188 | mISDN_FsmEvent(&l2->l2m, EV_L2_ACK_PULL, NULL); |
@@ -1490,8 +1493,8 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1490 | p1 = (l2->vs - l2->va) % 8; | 1493 | p1 = (l2->vs - l2->va) % 8; |
1491 | p1 = (p1 + l2->sow) % l2->window; | 1494 | p1 = (p1 + l2->sow) % l2->window; |
1492 | if (l2->windowar[p1]) { | 1495 | if (l2->windowar[p1]) { |
1493 | printk(KERN_WARNING "isdnl2 try overwrite ack queue entry %d\n", | 1496 | printk(KERN_WARNING "%s: l2 try overwrite ack queue entry %d\n", |
1494 | p1); | 1497 | mISDNDevName4ch(&l2->ch), p1); |
1495 | dev_kfree_skb(l2->windowar[p1]); | 1498 | dev_kfree_skb(l2->windowar[p1]); |
1496 | } | 1499 | } |
1497 | l2->windowar[p1] = skb; | 1500 | l2->windowar[p1] = skb; |
@@ -1511,12 +1514,14 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1511 | memcpy(skb_push(nskb, i), header, i); | 1514 | memcpy(skb_push(nskb, i), header, i); |
1512 | else { | 1515 | else { |
1513 | printk(KERN_WARNING | 1516 | printk(KERN_WARNING |
1514 | "isdnl2 pull_iqueue skb header(%d/%d) too short\n", i, p1); | 1517 | "%s: L2 pull_iqueue skb header(%d/%d) too short\n", |
1518 | mISDNDevName4ch(&l2->ch), i, p1); | ||
1515 | oskb = nskb; | 1519 | oskb = nskb; |
1516 | nskb = mI_alloc_skb(oskb->len + i, GFP_ATOMIC); | 1520 | nskb = mI_alloc_skb(oskb->len + i, GFP_ATOMIC); |
1517 | if (!nskb) { | 1521 | if (!nskb) { |
1518 | dev_kfree_skb(oskb); | 1522 | dev_kfree_skb(oskb); |
1519 | printk(KERN_WARNING "%s: no skb mem\n", __func__); | 1523 | printk(KERN_WARNING "%s: no skb mem in %s\n", |
1524 | mISDNDevName4ch(&l2->ch), __func__); | ||
1520 | return; | 1525 | return; |
1521 | } | 1526 | } |
1522 | memcpy(skb_put(nskb, i), header, i); | 1527 | memcpy(skb_put(nskb, i), header, i); |
@@ -1892,7 +1897,8 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1892 | ptei = *datap++; | 1897 | ptei = *datap++; |
1893 | if ((psapi & 1) || !(ptei & 1)) { | 1898 | if ((psapi & 1) || !(ptei & 1)) { |
1894 | printk(KERN_WARNING | 1899 | printk(KERN_WARNING |
1895 | "l2 D-channel frame wrong EA0/EA1\n"); | 1900 | "%s l2 D-channel frame wrong EA0/EA1\n", |
1901 | mISDNDevName4ch(&l2->ch)); | ||
1896 | return ret; | 1902 | return ret; |
1897 | } | 1903 | } |
1898 | psapi >>= 2; | 1904 | psapi >>= 2; |
@@ -1901,7 +1907,8 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1901 | /* not our business */ | 1907 | /* not our business */ |
1902 | if (*debug & DEBUG_L2) | 1908 | if (*debug & DEBUG_L2) |
1903 | printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n", | 1909 | printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n", |
1904 | __func__, psapi, l2->sapi); | 1910 | mISDNDevName4ch(&l2->ch), psapi, |
1911 | l2->sapi); | ||
1905 | dev_kfree_skb(skb); | 1912 | dev_kfree_skb(skb); |
1906 | return 0; | 1913 | return 0; |
1907 | } | 1914 | } |
@@ -1909,7 +1916,7 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1909 | /* not our business */ | 1916 | /* not our business */ |
1910 | if (*debug & DEBUG_L2) | 1917 | if (*debug & DEBUG_L2) |
1911 | printk(KERN_DEBUG "%s: tei %d/%d mismatch\n", | 1918 | printk(KERN_DEBUG "%s: tei %d/%d mismatch\n", |
1912 | __func__, ptei, l2->tei); | 1919 | mISDNDevName4ch(&l2->ch), ptei, l2->tei); |
1913 | dev_kfree_skb(skb); | 1920 | dev_kfree_skb(skb); |
1914 | return 0; | 1921 | return 0; |
1915 | } | 1922 | } |
@@ -1950,7 +1957,8 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb) | |||
1950 | } else | 1957 | } else |
1951 | c = 'L'; | 1958 | c = 'L'; |
1952 | if (c) { | 1959 | if (c) { |
1953 | printk(KERN_WARNING "l2 D-channel frame error %c\n", c); | 1960 | printk(KERN_WARNING "%s:l2 D-channel frame error %c\n", |
1961 | mISDNDevName4ch(&l2->ch), c); | ||
1954 | mISDN_FsmEvent(&l2->l2m, EV_L2_FRAME_ERROR, (void *)(long)c); | 1962 | mISDN_FsmEvent(&l2->l2m, EV_L2_FRAME_ERROR, (void *)(long)c); |
1955 | } | 1963 | } |
1956 | return ret; | 1964 | return ret; |
@@ -1964,15 +1972,16 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb) | |||
1964 | int ret = -EINVAL; | 1972 | int ret = -EINVAL; |
1965 | 1973 | ||
1966 | if (*debug & DEBUG_L2_RECV) | 1974 | if (*debug & DEBUG_L2_RECV) |
1967 | printk(KERN_DEBUG "%s: prim(%x) id(%x) sapi(%d) tei(%d)\n", | 1975 | printk(KERN_DEBUG "%s: %s prim(%x) id(%x) sapi(%d) tei(%d)\n", |
1968 | __func__, hh->prim, hh->id, l2->sapi, l2->tei); | 1976 | __func__, mISDNDevName4ch(&l2->ch), hh->prim, hh->id, |
1977 | l2->sapi, l2->tei); | ||
1969 | if (hh->prim == DL_INTERN_MSG) { | 1978 | if (hh->prim == DL_INTERN_MSG) { |
1970 | struct mISDNhead *chh = hh + 1; /* saved copy */ | 1979 | struct mISDNhead *chh = hh + 1; /* saved copy */ |
1971 | 1980 | ||
1972 | *hh = *chh; | 1981 | *hh = *chh; |
1973 | if (*debug & DEBUG_L2_RECV) | 1982 | if (*debug & DEBUG_L2_RECV) |
1974 | printk(KERN_DEBUG "%s: prim(%x) id(%x) internal msg\n", | 1983 | printk(KERN_DEBUG "%s: prim(%x) id(%x) internal msg\n", |
1975 | __func__, hh->prim, hh->id); | 1984 | mISDNDevName4ch(&l2->ch), hh->prim, hh->id); |
1976 | } | 1985 | } |
1977 | switch (hh->prim) { | 1986 | switch (hh->prim) { |
1978 | case PH_DATA_IND: | 1987 | case PH_DATA_IND: |
@@ -2053,7 +2062,8 @@ tei_l2(struct layer2 *l2, u_int cmd, u_long arg) | |||
2053 | int ret = -EINVAL; | 2062 | int ret = -EINVAL; |
2054 | 2063 | ||
2055 | if (*debug & DEBUG_L2_TEI) | 2064 | if (*debug & DEBUG_L2_TEI) |
2056 | printk(KERN_DEBUG "%s: cmd(%x)\n", __func__, cmd); | 2065 | printk(KERN_DEBUG "%s: cmd(%x) in %s\n", |
2066 | mISDNDevName4ch(&l2->ch), cmd, __func__); | ||
2057 | switch (cmd) { | 2067 | switch (cmd) { |
2058 | case (MDL_ASSIGN_REQ): | 2068 | case (MDL_ASSIGN_REQ): |
2059 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_MDL_ASSIGN, (void *)arg); | 2069 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_MDL_ASSIGN, (void *)arg); |
@@ -2066,7 +2076,8 @@ tei_l2(struct layer2 *l2, u_int cmd, u_long arg) | |||
2066 | break; | 2076 | break; |
2067 | case (MDL_ERROR_RSP): | 2077 | case (MDL_ERROR_RSP): |
2068 | /* ETS 300-125 5.3.2.1 Test: TC13010 */ | 2078 | /* ETS 300-125 5.3.2.1 Test: TC13010 */ |
2069 | printk(KERN_NOTICE "MDL_ERROR|REQ (tei_l2)\n"); | 2079 | printk(KERN_NOTICE "%s: MDL_ERROR|REQ (tei_l2)\n", |
2080 | mISDNDevName4ch(&l2->ch)); | ||
2070 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_MDL_ERROR, NULL); | 2081 | ret = mISDN_FsmEvent(&l2->l2m, EV_L2_MDL_ERROR, NULL); |
2071 | break; | 2082 | break; |
2072 | } | 2083 | } |
@@ -2098,7 +2109,8 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) | |||
2098 | u_int info; | 2109 | u_int info; |
2099 | 2110 | ||
2100 | if (*debug & DEBUG_L2_CTRL) | 2111 | if (*debug & DEBUG_L2_CTRL) |
2101 | printk(KERN_DEBUG "%s:(%x)\n", __func__, cmd); | 2112 | printk(KERN_DEBUG "%s: %s cmd(%x)\n", |
2113 | mISDNDevName4ch(ch), __func__, cmd); | ||
2102 | 2114 | ||
2103 | switch (cmd) { | 2115 | switch (cmd) { |
2104 | case OPEN_CHANNEL: | 2116 | case OPEN_CHANNEL: |