mISDN: Add XHFC support for embedded Speech-Design board to hfcmulti
[linux-2.6] / drivers / isdn / mISDN / layer2.c
index d6e2863..9c2589e 100644 (file)
@@ -99,7 +99,7 @@ l2m_debug(struct FsmInst *fi, char *fmt, ...)
        if (!(*debug & DEBUG_L2_FSM))
                return;
        va_start(va, fmt);
-       printk(KERN_DEBUG "l2 (tei %d): ", l2->tei);
+       printk(KERN_DEBUG "l2 (sapi %d tei %d): ", l2->sapi, l2->tei);
        vprintk(fmt, va);
        printk("\n");
        va_end(va);
@@ -1859,20 +1859,18 @@ ph_data_indication(struct layer2 *l2, struct mISDNhead *hh, struct sk_buff *skb)
                psapi >>= 2;
                ptei >>= 1;
                if (psapi != l2->sapi) {
-                       /* not our bussiness
-                        * printk(KERN_DEBUG "%s: sapi %d/%d sapi mismatch\n",
-                        *  __func__,
-                        *      psapi, l2->sapi);
-                        */
+                       /* not our bussiness */
+                       if (*debug & DEBUG_L2)
+                               printk(KERN_DEBUG "%s: sapi %d/%d mismatch\n",
+                                       __func__, psapi, l2->sapi);
                        dev_kfree_skb(skb);
                        return 0;
                }
                if ((ptei != l2->tei) && (ptei != GROUP_TEI)) {
-                       /* not our bussiness
-                        * printk(KERN_DEBUG "%s: tei %d/%d sapi %d mismatch\n",
-                        *  __func__,
-                        *      ptei, l2->tei, psapi);
-                        */
+                       /* not our bussiness */
+                       if (*debug & DEBUG_L2)
+                               printk(KERN_DEBUG "%s: tei %d/%d mismatch\n",
+                                       __func__, ptei, l2->tei);
                        dev_kfree_skb(skb);
                        return 0;
                }
@@ -1927,8 +1925,8 @@ l2_send(struct mISDNchannel *ch, struct sk_buff *skb)
        int                     ret = -EINVAL;
 
        if (*debug & DEBUG_L2_RECV)
-               printk(KERN_DEBUG "%s: prim(%x) id(%x) tei(%d)\n",
-                   __func__, hh->prim, hh->id, l2->tei);
+               printk(KERN_DEBUG "%s: prim(%x) id(%x) sapi(%d) tei(%d)\n",
+                   __func__, hh->prim, hh->id, l2->sapi, l2->tei);
        switch (hh->prim) {
        case PH_DATA_IND:
                ret = ph_data_indication(l2, hh, skb);
@@ -2068,7 +2066,8 @@ l2_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
 }
 
 struct layer2 *
-create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
+create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, int tei,
+               int sapi)
 {
        struct layer2           *l2;
        struct channel_req      rq;
@@ -2089,7 +2088,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
                test_and_set_bit(FLG_LAPD, &l2->flag);
                test_and_set_bit(FLG_LAPD_NET, &l2->flag);
                test_and_set_bit(FLG_MOD128, &l2->flag);
-               l2->sapi = 0;
+               l2->sapi = sapi;
                l2->maxlen = MAX_DFRAME_LEN;
                if (test_bit(OPTION_L2_PMX, &options))
                        l2->window = 7;
@@ -2099,7 +2098,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
                        test_and_set_bit(FLG_PTP, &l2->flag);
                if (test_bit(OPTION_L2_FIXEDTEI, &options))
                        test_and_set_bit(FLG_FIXED_TEI, &l2->flag);
-               l2->tei = (u_int)arg;
+               l2->tei = tei;
                l2->T200 = 1000;
                l2->N200 = 3;
                l2->T203 = 10000;
@@ -2114,7 +2113,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
                test_and_set_bit(FLG_LAPD, &l2->flag);
                test_and_set_bit(FLG_MOD128, &l2->flag);
                test_and_set_bit(FLG_ORIG, &l2->flag);
-               l2->sapi = 0;
+               l2->sapi = sapi;
                l2->maxlen = MAX_DFRAME_LEN;
                if (test_bit(OPTION_L2_PMX, &options))
                        l2->window = 7;
@@ -2124,7 +2123,7 @@ create_l2(struct mISDNchannel *ch, u_int protocol, u_long options, u_long arg)
                        test_and_set_bit(FLG_PTP, &l2->flag);
                if (test_bit(OPTION_L2_FIXEDTEI, &options))
                        test_and_set_bit(FLG_FIXED_TEI, &l2->flag);
-               l2->tei = (u_int)arg;
+               l2->tei = tei;
                l2->T200 = 1000;
                l2->N200 = 3;
                l2->T203 = 10000;
@@ -2180,7 +2179,7 @@ x75create(struct channel_req *crq)
 
        if (crq->protocol != ISDN_P_B_X75SLP)
                return -EPROTONOSUPPORT;
-       l2 = create_l2(crq->ch, crq->protocol, 0, 0);
+       l2 = create_l2(crq->ch, crq->protocol, 0, 0, 0);
        if (!l2)
                return -ENOMEM;
        crq->ch = &l2->ch;