Commit 3a68ca01 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: exclusive handling in isdn_net_force_dial_lp()

When using exclusive mode, we already reserved our channel
at the time that mode was set, so no need to get a free channel
in this case.

Also, indent cleanups to isdn_net_start_xmit().
parent e9858030
...@@ -1043,96 +1043,94 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1043,96 +1043,94 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
return isdn_x25_start_xmit(skb, ndev); return isdn_x25_start_xmit(skb, ndev);
/* auto-dialing xmit function */ /* auto-dialing xmit function */
{ isdn_net_adjust_hdr(skb, ndev);
isdn_net_adjust_hdr(skb, ndev); isdn_dumppkt("S:", skb->data, skb->len, 40);
isdn_dumppkt("S:", skb->data, skb->len, 40);
if (!isdn_net_bound(lp)) {
if (!isdn_net_bound(lp)) { int chi;
int chi; /* only do autodial if allowed by config */
/* only do autodial if allowed by config */ if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) {
if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) { isdn_net_unreachable(ndev, skb, "dial rejected: interface not in dialmode `auto'");
isdn_net_unreachable(ndev, skb, "dial rejected: interface not in dialmode `auto'"); dev_kfree_skb(skb);
dev_kfree_skb(skb); return 0;
return 0; }
}
save_flags(flags);
cli();
save_flags(flags); if(lp->dialwait_timer <= 0)
cli(); if(lp->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait))
lp->dialwait_timer = lp->dialstarted + lp->dialtimeout + lp->dialwait;
if(lp->dialwait_timer <= 0)
if(lp->dialstarted > 0 && lp->dialtimeout > 0 && time_before(jiffies, lp->dialstarted + lp->dialtimeout + lp->dialwait)) if(lp->dialwait_timer > 0) {
lp->dialwait_timer = lp->dialstarted + lp->dialtimeout + lp->dialwait; if(time_before(jiffies, lp->dialwait_timer)) {
isdn_net_unreachable(ndev, skb, "dial rejected: retry-time not reached");
if(lp->dialwait_timer > 0) {
if(time_before(jiffies, lp->dialwait_timer)) {
isdn_net_unreachable(ndev, skb, "dial rejected: retry-time not reached");
dev_kfree_skb(skb);
restore_flags(flags);
return 0;
} else
lp->dialwait_timer = 0;
}
/* Grab a free ISDN-Channel */
if (((chi =
isdn_get_free_slot(
ISDN_USAGE_NET,
lp->l2_proto,
lp->l3_proto,
lp->pre_device,
lp->pre_channel,
lp->msn)
) < 0) &&
((chi =
isdn_get_free_slot(
ISDN_USAGE_NET,
lp->l2_proto,
lp->l3_proto,
lp->pre_device,
lp->pre_channel^1,
lp->msn)
) < 0)) {
restore_flags(flags);
isdn_net_unreachable(ndev, skb,
"No channel");
dev_kfree_skb(skb); dev_kfree_skb(skb);
restore_flags(flags);
return 0; return 0;
} } else
/* Log packet, which triggered dialing */ lp->dialwait_timer = 0;
if (dev->net_verbose) }
isdn_net_log_skb(skb, lp); /* Grab a free ISDN-Channel */
/* Connect interface with channel */ if (((chi =
isdn_net_bind_channel(lp, chi); isdn_get_free_slot(
ISDN_USAGE_NET,
if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) { lp->l2_proto,
/* no 'first_skb' handling for syncPPP */ lp->l3_proto,
if (isdn_ppp_bind(lp) < 0) { lp->pre_device,
dev_kfree_skb(skb); lp->pre_channel,
isdn_net_unbind_channel(lp); lp->msn)
restore_flags(flags); ) < 0) &&
return 0; /* STN (skb to nirvana) ;) */ ((chi =
} isdn_get_free_slot(
ISDN_USAGE_NET,
lp->l2_proto,
lp->l3_proto,
lp->pre_device,
lp->pre_channel^1,
lp->msn)
) < 0)) {
restore_flags(flags);
isdn_net_unreachable(ndev, skb,
"No channel");
dev_kfree_skb(skb);
return 0;
}
/* Log packet, which triggered dialing */
if (dev->net_verbose)
isdn_net_log_skb(skb, lp);
/* Connect interface with channel */
isdn_net_bind_channel(lp, chi);
if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) {
/* no 'first_skb' handling for syncPPP */
if (isdn_ppp_bind(lp) < 0) {
dev_kfree_skb(skb);
isdn_net_unbind_channel(lp);
restore_flags(flags); restore_flags(flags);
init_dialout(lp); return 0; /* STN (skb to nirvana) ;) */
netif_stop_queue(ndev);
return 1; /* let upper layer requeue skb packet */
} }
/* Initiate dialing */
restore_flags(flags); restore_flags(flags);
init_dialout(lp); init_dialout(lp);
isdn_net_device_stop_queue(lp); netif_stop_queue(ndev);
return 1; return 1; /* let upper layer requeue skb packet */
} else {
/* Device is connected to an ISDN channel */
ndev->trans_start = jiffies;
if (lp->dialstate == ST_ACTIVE) {
/* ISDN connection is established, try sending */
int ret;
ret = (isdn_net_xmit(ndev, skb));
if(ret) netif_stop_queue(ndev);
return ret;
} else
netif_stop_queue(ndev);
} }
/* Initiate dialing */
restore_flags(flags);
init_dialout(lp);
isdn_net_device_stop_queue(lp);
return 1;
} else {
/* Device is connected to an ISDN channel */
ndev->trans_start = jiffies;
if (lp->dialstate == ST_ACTIVE) {
/* ISDN connection is established, try sending */
int ret;
ret = (isdn_net_xmit(ndev, skb));
if(ret) netif_stop_queue(ndev);
return ret;
} else
netif_stop_queue(ndev);
} }
return 1; return 1;
} }
...@@ -1695,28 +1693,33 @@ isdn_net_force_dial_lp(isdn_net_local * lp) ...@@ -1695,28 +1693,33 @@ isdn_net_force_dial_lp(isdn_net_local * lp)
save_flags(flags); save_flags(flags);
cli(); cli();
/* Grab a free ISDN-Channel */ if (lp->exclusive >= 0) {
chi = isdn_get_free_slot(ISDN_USAGE_NET, lp->l2_proto, lp->l3_proto, chi = lp->exclusive;
lp->pre_device, lp->pre_channel, lp->msn); } else {
chi = isdn_get_free_slot(ISDN_USAGE_NET, lp->l2_proto, lp->l3_proto,
lp->pre_device, lp->pre_channel, lp->msn);
}
if (chi < 0) { if (chi < 0) {
printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name); printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name);
restore_flags(flags); goto err;
return -EAGAIN;
} }
/* Connect interface with channel */ /* Connect interface with channel */
isdn_net_bind_channel(lp, chi); isdn_net_bind_channel(lp, chi);
if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
if (isdn_ppp_bind(lp) < 0) { if (isdn_ppp_bind(lp) < 0) {
isdn_net_unbind_channel(lp); isdn_net_unbind_channel(lp);
restore_flags(flags); goto err;
return -EAGAIN;
} }
/* Initiate dialing */ /* Initiate dialing */
restore_flags(flags); restore_flags(flags);
init_dialout(lp); init_dialout(lp);
return 0; return 0;
err:
restore_flags(flags);
return -EAGAIN;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment