Project

General

Profile

Sangoma Wanpipe DAHDI » History » Version 5

laforge, 12/30/2021 09:05 AM

1 1 laforge
h1. Sangoma Wanpipe DAHDI
2
3 5 laforge
{{>toc}}
4
5 1 laforge
some random notes on bulding DAHDI drivers for Sangoma AFT104 cards on a modern Debian 11 / buster
6
7
h2. Sources
8
9
* wanpipe 7.0.34 (e.g. via https://git.osmocom.org/wanpipe)
10
* dahdi-linux (e.g. https://github.com/osmocom/dahdi-linux)
11
12
h2. Building
13
14
# build + install dahdi-linux
15
#* usual make + sudo make install
16
17
h3. building sangoma wanpipe drivers
18
19
<pre>
20
$ cp ~/dahdi-linux/drivers/dahdi/Module.symvers ~/wanpipe/patches/kdrivers/src/net
21 2 laforge
$ make -j4 dahdi DAHDI_DIR=/home/laforge/dahdi-linux KBUILD_EXTRA_SYMBOLS=/home/laforge/dahdi-linux/drivers/dahdi/Module.symvers
22 1 laforge
</pre>
23
24 2 laforge
the importance is to pass the correct Module.symvers from the DAHDI build as KBUILD_EXTRA_SYMBOLS, as otherwise the wanpipe drivers will fail to load with errors like this:
25
26 1 laforge
This somehow fails, the Module.symvers gets overwritten and the module fails with various related errors:
27
<pre>
28
[ 4874.442680] wanpipe: no symbol version for dahdi_hdlc_putbuf
29
[ 4874.442702] wanpipe: Unknown symbol dahdi_hdlc_putbuf (err -22)
30
[ 4874.442754] wanpipe: no symbol version for _dahdi_ec_span
31
[ 4874.442760] wanpipe: Unknown symbol _dahdi_ec_span (err -22)
32 2 laforge
..
33 3 laforge
</pre>
34 1 laforge
35 5 laforge
h2. Loading of kernel drivers
36 3 laforge
37
If you want to manually load the modules
38
* @modprobe dahdi@ (assumption is that dahdi is already installed to @/lib/modules/@)
39
* from within@wanpipe/patches/kdrivers/src/net@
40
** @insmod sdladrv.ko@
41
** @insmod wanrouter.ko@
42 1 laforge
** @insmod wanpipe.ko@
43 5 laforge
** @insmod wanec.ko@
44 3 laforge
45
you should then see something like this below (my system has two AFT-104-SH cards installed):
46
47
<pre>
48
[ 5890.715722] WANPIPE(tm) Multi-Protocol WAN Driver Module 7.0.34.0 (c) 1994-2016 Sangoma Technologies Inc
49
[ 5890.715732] wanpipe: Probing for WANPIPE hardware.
50
[ 5890.716232] wanpipe: AFT-A104-SH PCI T1/E1 card found (HDLC rev.26), cpu(s) 1, line(s) 4, bus #2, slot #0, irq #25
51
[ 5890.716524] wanpipe: AFT-A104-SH PCI T1/E1 card found (HDLC rev.26), cpu(s) 1, line(s) 4, bus #2, slot #1, irq #27
52
[ 5890.716665] wanpipe: Allocating maximum 8 devices: wanpipe1 - wanpipe8.
53
[ 5890.719054] WANPIPE: TDM Codecs Initialized
54
</pre>
55 4 laforge
56
equally there should now be a lot of /proc/net/wanrouter/ files
57
58
<pre>
59
$ cat /proc/net/wanrouter/hwprobe
60
-------------------------------
61
| Wanpipe Hardware Probe Info |
62
-------------------------------
63
1 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=1 : HWEC=128 : V=26
64
2 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=2 : HWEC=128 : V=26
65
3 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=3 : HWEC=128 : V=26
66
4 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=4 : HWEC=128 : V=26
67
5 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=1 : HWEC=128 : V=26
68
6 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=2 : HWEC=128 : V=26
69
7 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=3 : HWEC=128 : V=26
70
8 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=4 : HWEC=128 : V=26
71
72 1 laforge
Sangoma Card Count: A104=2 
73 5 laforge
</pre>
74
75
h2. Configuration of wanpipe kernel drivers
76
77
The sangoma wanpipe tarballs ship a bizarre combination of C++ code that generates shell scripts which call perl code which generates config files (then parsed by C code). It's a nightmare, and I'm not sure why anyone would want to bother with this.   All I want is some kind of clear documentation which ioctl()s (or a C command line tool executing those) are required to bring the device up.
78
79
After some reading of the kernel sources, it tunrs out that the ROUTER_IFNEW ioctl is really all that's needed to get a sangoma wanpipe card exposed to dahdi.
80
81
There's the @util/wanconfig@ program that can drive this ioctl.  You can specify a plethora of command line arguments or put all of those in a config file.  Those configs are usually located in @/etc/wanpipe/wanpipeX.conf@ where X is for each of your wanpipe cards.
82
83
h3. /etc/wanpipe/wanpipeX.conf file
84
85
I'm using the following example for @/etc/wanpipe/wanpipe1.conf@:
86
<pre>
87
88
[devices]
89
wanpipe1 = WAN_AFT_TE1, Comment
90
91
[interfaces]
92
w1g1 = wanpipe1, , TDM_VOICE, Comment
93
94
[wanpipe1]
95
CARD_TYPE       = AFT
96
S514CPU         = A
97
CommPort        = PRI
98
AUTO_PCISLOT    = NO
99
PCISLOT         = 0
100
PCIBUS          = 2
101
FE_MEDIA        = E1
102
FE_LCODE        = HDB3
103
FE_FRAME        = CRC4
104
FE_LINE         = 1
105
TE_CLOCK        = NORMAL
106
TE_REF_CLOCK    = 0
107
ACTIVE_CH       = ALL
108
TE_HIGHIMPEDANCE        = NO
109
LBO             = NONE
110
FE_TXTRISTATE   = NO
111
MTU             = 1500
112
UDPPORT         = 9000
113
TTL             = 255
114
IGNORE_FRONT_END = NO
115
TDMV_SPAN       = 1
116
TDMV_DCHAN      = 15
117
118
[w1g1]
119
ACTIVE_CH       = ALL
120
TDMV_ECHO_OFF   = NO
121
</pre>
122
123
Note: You will need to fill the PCISLOT, PCIBUS etc. parameters according to your output pf /proc/net/wanrouter/hwprobe.
124
125
h3. Applying the configuration to the kernel
126
127
@wanconfig -f /etc/wanpipe/wanpipe1.conf@ will put together the ioctl() to the kernel and should ideally succeed.  If it does, you will get something like this in your dmesg:
128
129
<pre>
130
[42799.010236] Processing WAN device wanpipe1...
131
[42799.010249] wanpipe1: Locating: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0
132
[42799.010266] wanpipe1: Found: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0, Port=0
133
[42799.010379] wanpipe1: AFT PCI memory at 0xFE500000
134
[42799.010386] wanpipe1: IRQ 25 allocated to the AFT PCI card
135
[42799.010465] wanpipe1: Starting AFT 2/4/8 Hardware Init.
136
[42799.010506] wanpipe1: Enabling front end link monitor
137
[42799.010516] wanpipe1: Global Chip Configuration: used=1 used_type=1
138
[42799.013910] wanpipe1: AFT Data Mux Bit Map: 0x01234567
139
[42799.013946] wanpipe1: Defaulting E1 LBO        = 120 OH
140
[42799.013951] wanpipe1: Defaulting E1 Signalling = CCS
141
[42799.013957] wanpipe1: Configuring PMC COMET-QUAD E1 FE
142
[42799.013965] wanpipe1:    Port 1,HDB3,CRC4,120OH
143
[42799.013972] wanpipe1:    Clk Normal:0, Ch FFFFFFFF
144
[42799.013977] wanpipe1:    Sig Mode CCS
145
[42799.182498] wanpipe1: Front end successful
146
[42799.182506] wanpipe1: Configuring FE Line=1 Clock Source: Line=1 Normal
147
[42799.182741] wanpipe1: Front End Interface Ready 0x40000000
148
[42799.182756] wanpipe1: Register EC interface wanec1 (usage 1, max ec chans 128)!
149
[42799.182774] wanpipe1: Configuring Device   :wanpipe1  FrmVr=26
150
[42799.182777] wanpipe1:    Global MTU     = 1500
151
[42799.182780] wanpipe1:    Global MRU     = 1500
152
[42799.182784] wanpipe1:    Data Mux Map   = 0x01234567
153
[42799.182786] wanpipe1:    Rx CRC Bytes   = 0
154
[42799.182789] wanpipe1:    RBS Signalling = Off
155
[42799.182793] wanpipe1:    Global TDM Int = Enabled
156
[42799.182796] wanpipe1:    Global TDM Ring= HW Ring
157
[42799.182799] wanpipe1:    Global SPAN IRQ= RX/TX
158
[42799.182802] wanpipe1:    TDM HW TONE    = Disabled
159
[42799.182806] wanpipe1:    Fifo Trigger   = rx:50 tx:50 (events per sec)
160
[42799.182809] wanpipe1:    TDMV Span      = 1 : Enabled
161
[42799.182812] wanpipe1:    TDMV Dummy     = Disabled
162
[42799.182816] wanpipe1:    RTP TAP        = Disabled
163
[42799.182915] wanpipe1: Initializing TE1 Voice functions
164
[42799.183149] wanpipe1:    Global Poll IRQ= Disabled
165
[42799.183157] wanpipe1: Configuring Interface: w1g1
166
[42799.183173] wanpipe1: w1g1 Running in TDM Voice Zaptel Mode.
167
[42799.183180] wanpipe1:    Fifo Level Map:0x01041040
168
[42799.183188] wanpipe1:    MRU           :8 (Chunk/Period=80/10)
169
[42799.183192] wanpipe1:    MTU           :8 (Chunk/Period=80/10)
170
[42799.183196] wanpipe1:    HDLC Eng      :Off (Transparent) | N/A
171
[42799.183203] wanpipe1:    Data Mux Ctrl :On
172
[42799.183206] wanpipe1:    Active Ch Map :0x00000002
173
[42799.183210] wanpipe1:    First TSlot   :1
174
[42799.183257] wanpipe1:    DMA/Len/Idle/ChainR/ChainT/EC :65/1024/8/Off/Off/Off
175
[42799.183263] wanpipe1:    Memory: Chan=5680
176
[42799.183504] wanpipe1: Configuring Interface: w1g1 (log supress)
177
[42799.183519] wanpipe1:    Active Ch Map :0x00000004
178
[42799.183523] wanpipe1:    First TSlot   :2
179
[42799.183756] wanpipe1: Configuring Interface: w1g1 (log supress)
180
[42799.183772] wanpipe1:    Active Ch Map :0x00000008
181
[42799.183775] wanpipe1:    First TSlot   :3
182
...
183
[42799.192799] wanpipe1: Configuring Interface: w1g1 (log supress)
184
[42799.192858] wanpipe1: Configuring TDMV Master dev w1g1
185
[42799.192868] wanpipe1:    Active Ch Map :0x80000000
186
[42799.192872] wanpipe1:    First TSlot   :31
187
[42799.202242] wanpipe1: Wanpipe device is registered to Zaptel span # 1!
188
[42799.209532] wanpipe1: TDM Timing Enabled 1 ms
189
[42800.205759] wanpipe1: E1 disconnected!
190
</pre>
191
192
Equally, you will get a @/proc/dahdi/1@ device for that first E1 span.
193
194
h3. Connecting E1
195
196
Once your E1 link is up, you will get:
197
198
<pre>
199
[42995.786699] wanpipe1: E1 connected!
200
[42995.789324] wanpipe1: AFT communications enabled
201
[42995.791333] wanpipe1: AFT Global TDM Intr
202
[42995.791410] wanpipe1: TDM Timing Disabled!
203
[42996.811333] wanpipe1: Enable E1 Interrupts 
204 4 laforge
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)