aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/tei.c
diff options
context:
space:
mode:
authorAndreas Eversberg <andreas@eversberg.eu>2009-05-22 07:04:48 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-25 03:51:33 -0400
commite73f6b2260daf02793071e5ce06ea87df762920a (patch)
tree5d5b2706a8a1c55d74a1488b083ad9253c03dc91 /drivers/isdn/mISDN/tei.c
parentba3af34ec9866dddac36c15947f867eb8e889bbc (diff)
mISDN: Added layer-1-hold feature
Add IMHOLD_L1 ioctl. The feature will be disabled on closing. Signed-off-by: Andreas Eversberg <andreas@eversberg.eu> Signed-off-by: Karsten Keil <keil@b1-systems.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/mISDN/tei.c')
-rw-r--r--drivers/isdn/mISDN/tei.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c
index b452dead8fd0..c75af762a067 100644
--- a/drivers/isdn/mISDN/tei.c
+++ b/drivers/isdn/mISDN/tei.c
@@ -122,8 +122,11 @@ da_deactivate(struct FsmInst *fi, int event, void *arg)
122 } 122 }
123 read_unlock_irqrestore(&mgr->lock, flags); 123 read_unlock_irqrestore(&mgr->lock, flags);
124 /* All TEI are inactiv */ 124 /* All TEI are inactiv */
125 mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, NULL, 1); 125 if (!test_bit(OPTION_L1_HOLD, &mgr->options)) {
126 mISDN_FsmChangeState(fi, ST_L1_DEACT_PENDING); 126 mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER,
127 NULL, 1);
128 mISDN_FsmChangeState(fi, ST_L1_DEACT_PENDING);
129 }
127} 130}
128 131
129static void 132static void
@@ -132,9 +135,11 @@ da_ui(struct FsmInst *fi, int event, void *arg)
132 struct manager *mgr = fi->userdata; 135 struct manager *mgr = fi->userdata;
133 136
134 /* restart da timer */ 137 /* restart da timer */
135 mISDN_FsmDelTimer(&mgr->datimer, 2); 138 if (!test_bit(OPTION_L1_HOLD, &mgr->options)) {
136 mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER, NULL, 2); 139 mISDN_FsmDelTimer(&mgr->datimer, 2);
137 140 mISDN_FsmAddTimer(&mgr->datimer, DATIMER_VAL, EV_DATIMER,
141 NULL, 2);
142 }
138} 143}
139 144
140static void 145static void
@@ -1103,6 +1108,7 @@ free_teimanager(struct manager *mgr)
1103{ 1108{
1104 struct layer2 *l2, *nl2; 1109 struct layer2 *l2, *nl2;
1105 1110
1111 test_and_clear_bit(OPTION_L1_HOLD, &mgr->options);
1106 if (test_bit(MGR_OPT_NETWORK, &mgr->options)) { 1112 if (test_bit(MGR_OPT_NETWORK, &mgr->options)) {
1107 /* not locked lock is taken in release tei */ 1113 /* not locked lock is taken in release tei */
1108 mgr->up = NULL; 1114 mgr->up = NULL;
@@ -1133,13 +1139,26 @@ static int
1133ctrl_teimanager(struct manager *mgr, void *arg) 1139ctrl_teimanager(struct manager *mgr, void *arg)
1134{ 1140{
1135 /* currently we only have one option */ 1141 /* currently we only have one option */
1136 int clean = *((int *)arg); 1142 int *val = (int *)arg;
1137 1143 int ret = 0;
1138 if (clean) 1144
1139 test_and_set_bit(OPTION_L2_CLEANUP, &mgr->options); 1145 switch (val[0]) {
1140 else 1146 case IMCLEAR_L2:
1141 test_and_clear_bit(OPTION_L2_CLEANUP, &mgr->options); 1147 if (val[1])
1142 return 0; 1148 test_and_set_bit(OPTION_L2_CLEANUP, &mgr->options);
1149 else
1150 test_and_clear_bit(OPTION_L2_CLEANUP, &mgr->options);
1151 break;
1152 case IMHOLD_L1:
1153 if (val[1])
1154 test_and_set_bit(OPTION_L1_HOLD, &mgr->options);
1155 else
1156 test_and_clear_bit(OPTION_L1_HOLD, &mgr->options);
1157 break;
1158 default:
1159 ret = -EINVAL;
1160 }
1161 return ret;
1143} 1162}
1144 1163
1145/* This function does create a L2 for fixed TEI in NT Mode */ 1164/* This function does create a L2 for fixed TEI in NT Mode */