Project

General

Profile

Sangoma Wanpipe DAHDI » History » Version 7

laforge, 07/25/2022 06:47 AM
gitea links

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 7 laforge
* wanpipe 7.0.34 (e.g. via https://gitea.osmocom.org/retronetworking/wanpipe)
10
* dahdi-linux (e.g. https://gitea.osmocom.org/retronetworking/dahdi-linux)
11 1 laforge
12 6 laforge
h2. Building 
13 1 laforge
14 6 laforge
h3. the offiial way
15
16
some incredible convolution of shell scripts, c programs, perl script  and other bits and pieces, which all fail in various ways.
17
18
h3. the manual way
19
20 1 laforge
# build + install dahdi-linux
21
#* usual make + sudo make install
22
23 6 laforge
h4. building sangoma wanpipe drivers
24 1 laforge
25
<pre>
26 2 laforge
$ make -j4 dahdi DAHDI_DIR=/home/laforge/dahdi-linux KBUILD_EXTRA_SYMBOLS=/home/laforge/dahdi-linux/drivers/dahdi/Module.symvers
27 1 laforge
</pre>
28
29 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:
30
31 1 laforge
This somehow fails, the Module.symvers gets overwritten and the module fails with various related errors:
32
<pre>
33
[ 4874.442680] wanpipe: no symbol version for dahdi_hdlc_putbuf
34 3 laforge
[ 4874.442702] wanpipe: Unknown symbol dahdi_hdlc_putbuf (err -22)
35
[ 4874.442754] wanpipe: no symbol version for _dahdi_ec_span
36
[ 4874.442760] wanpipe: Unknown symbol _dahdi_ec_span (err -22)
37 1 laforge
..
38
</pre>
39
40 6 laforge
h2. Building (using Makefile.debian11)
41
42 7 laforge
In the osmocom wanpipe git repo at  https://gitea.osmocom.org/retronetworking/wanpipe/ we've added a @Makefile.debian@ which will help you in building + installing a lean/minimal driver set.
43 6 laforge
44
It supports two targets:
45
* @build@ (default, compiles kernel driver and minimal userspae lib+tool)
46
* @install@ (installs the kernel driver, library and userspace tool)
47
48 1 laforge
h2. Loading of kernel drivers
49 5 laforge
50 6 laforge
This assumes that you have installed the kernel modules (both DAHDI and wanpipe) and exeuted depmod.
51
52
* @modprobe dahdi@
53
* @modprobe wanpipe@
54
* @modprobe wanec@
55 3 laforge
56
you should then see something like this below (my system has two AFT-104-SH cards installed):
57
58
<pre>
59
[ 5890.715722] WANPIPE(tm) Multi-Protocol WAN Driver Module 7.0.34.0 (c) 1994-2016 Sangoma Technologies Inc
60
[ 5890.715732] wanpipe: Probing for WANPIPE hardware.
61 4 laforge
[ 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
62
[ 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
63
[ 5890.716665] wanpipe: Allocating maximum 8 devices: wanpipe1 - wanpipe8.
64
[ 5890.719054] WANPIPE: TDM Codecs Initialized
65
</pre>
66
67
equally there should now be a lot of /proc/net/wanrouter/ files
68
69
<pre>
70
$ cat /proc/net/wanrouter/hwprobe
71
-------------------------------
72
| Wanpipe Hardware Probe Info |
73
-------------------------------
74
1 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=1 : HWEC=128 : V=26
75
2 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=2 : HWEC=128 : V=26
76
3 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=3 : HWEC=128 : V=26
77
4 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=4 : HWEC=128 : V=26
78 1 laforge
5 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=1 : HWEC=128 : V=26
79 5 laforge
6 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=2 : HWEC=128 : V=26
80
7 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=3 : HWEC=128 : V=26
81
8 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=4 : HWEC=128 : V=26
82
83
Sangoma Card Count: A104=2 
84
</pre>
85
86
h2. Configuration of wanpipe kernel drivers
87
88
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.
89
90
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.
91
92
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.
93
94
h3. /etc/wanpipe/wanpipeX.conf file
95
96
I'm using the following example for @/etc/wanpipe/wanpipe1.conf@:
97
<pre>
98
99
[devices]
100
wanpipe1 = WAN_AFT_TE1, Comment
101
102
[interfaces]
103
w1g1 = wanpipe1, , TDM_VOICE, Comment
104
105
[wanpipe1]
106
CARD_TYPE       = AFT
107
S514CPU         = A
108
CommPort        = PRI
109
AUTO_PCISLOT    = NO
110
PCISLOT         = 0
111
PCIBUS          = 2
112
FE_MEDIA        = E1
113
FE_LCODE        = HDB3
114
FE_FRAME        = CRC4
115
FE_LINE         = 1
116
TE_CLOCK        = NORMAL
117
TE_REF_CLOCK    = 0
118
ACTIVE_CH       = ALL
119
TE_HIGHIMPEDANCE        = NO
120
LBO             = NONE
121
FE_TXTRISTATE   = NO
122
MTU             = 1500
123
UDPPORT         = 9000
124
TTL             = 255
125
IGNORE_FRONT_END = NO
126
TDMV_SPAN       = 1
127
TDMV_DCHAN      = 15
128
129
[w1g1]
130
ACTIVE_CH       = ALL
131
TDMV_ECHO_OFF   = NO
132
</pre>
133
134
Note: You will need to fill the PCISLOT, PCIBUS etc. parameters according to your output pf /proc/net/wanrouter/hwprobe.
135
136
h3. Applying the configuration to the kernel
137
138
@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:
139
140
<pre>
141
[42799.010236] Processing WAN device wanpipe1...
142
[42799.010249] wanpipe1: Locating: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0
143
[42799.010266] wanpipe1: Found: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0, Port=0
144
[42799.010379] wanpipe1: AFT PCI memory at 0xFE500000
145
[42799.010386] wanpipe1: IRQ 25 allocated to the AFT PCI card
146
[42799.010465] wanpipe1: Starting AFT 2/4/8 Hardware Init.
147
[42799.010506] wanpipe1: Enabling front end link monitor
148
[42799.010516] wanpipe1: Global Chip Configuration: used=1 used_type=1
149
[42799.013910] wanpipe1: AFT Data Mux Bit Map: 0x01234567
150
[42799.013946] wanpipe1: Defaulting E1 LBO        = 120 OH
151
[42799.013951] wanpipe1: Defaulting E1 Signalling = CCS
152
[42799.013957] wanpipe1: Configuring PMC COMET-QUAD E1 FE
153
[42799.013965] wanpipe1:    Port 1,HDB3,CRC4,120OH
154
[42799.013972] wanpipe1:    Clk Normal:0, Ch FFFFFFFF
155
[42799.013977] wanpipe1:    Sig Mode CCS
156
[42799.182498] wanpipe1: Front end successful
157
[42799.182506] wanpipe1: Configuring FE Line=1 Clock Source: Line=1 Normal
158
[42799.182741] wanpipe1: Front End Interface Ready 0x40000000
159
[42799.182756] wanpipe1: Register EC interface wanec1 (usage 1, max ec chans 128)!
160
[42799.182774] wanpipe1: Configuring Device   :wanpipe1  FrmVr=26
161
[42799.182777] wanpipe1:    Global MTU     = 1500
162
[42799.182780] wanpipe1:    Global MRU     = 1500
163
[42799.182784] wanpipe1:    Data Mux Map   = 0x01234567
164
[42799.182786] wanpipe1:    Rx CRC Bytes   = 0
165
[42799.182789] wanpipe1:    RBS Signalling = Off
166
[42799.182793] wanpipe1:    Global TDM Int = Enabled
167
[42799.182796] wanpipe1:    Global TDM Ring= HW Ring
168
[42799.182799] wanpipe1:    Global SPAN IRQ= RX/TX
169
[42799.182802] wanpipe1:    TDM HW TONE    = Disabled
170
[42799.182806] wanpipe1:    Fifo Trigger   = rx:50 tx:50 (events per sec)
171
[42799.182809] wanpipe1:    TDMV Span      = 1 : Enabled
172
[42799.182812] wanpipe1:    TDMV Dummy     = Disabled
173
[42799.182816] wanpipe1:    RTP TAP        = Disabled
174
[42799.182915] wanpipe1: Initializing TE1 Voice functions
175
[42799.183149] wanpipe1:    Global Poll IRQ= Disabled
176
[42799.183157] wanpipe1: Configuring Interface: w1g1
177
[42799.183173] wanpipe1: w1g1 Running in TDM Voice Zaptel Mode.
178
[42799.183180] wanpipe1:    Fifo Level Map:0x01041040
179
[42799.183188] wanpipe1:    MRU           :8 (Chunk/Period=80/10)
180
[42799.183192] wanpipe1:    MTU           :8 (Chunk/Period=80/10)
181
[42799.183196] wanpipe1:    HDLC Eng      :Off (Transparent) | N/A
182
[42799.183203] wanpipe1:    Data Mux Ctrl :On
183
[42799.183206] wanpipe1:    Active Ch Map :0x00000002
184
[42799.183210] wanpipe1:    First TSlot   :1
185
[42799.183257] wanpipe1:    DMA/Len/Idle/ChainR/ChainT/EC :65/1024/8/Off/Off/Off
186
[42799.183263] wanpipe1:    Memory: Chan=5680
187
[42799.183504] wanpipe1: Configuring Interface: w1g1 (log supress)
188
[42799.183519] wanpipe1:    Active Ch Map :0x00000004
189
[42799.183523] wanpipe1:    First TSlot   :2
190
[42799.183756] wanpipe1: Configuring Interface: w1g1 (log supress)
191
[42799.183772] wanpipe1:    Active Ch Map :0x00000008
192
[42799.183775] wanpipe1:    First TSlot   :3
193
...
194
[42799.192799] wanpipe1: Configuring Interface: w1g1 (log supress)
195
[42799.192858] wanpipe1: Configuring TDMV Master dev w1g1
196
[42799.192868] wanpipe1:    Active Ch Map :0x80000000
197
[42799.192872] wanpipe1:    First TSlot   :31
198
[42799.202242] wanpipe1: Wanpipe device is registered to Zaptel span # 1!
199
[42799.209532] wanpipe1: TDM Timing Enabled 1 ms
200
[42800.205759] wanpipe1: E1 disconnected!
201
</pre>
202
203
Equally, you will get a @/proc/dahdi/1@ device for that first E1 span.
204
205
h3. Connecting E1
206
207
Once your E1 link is up, you will get:
208
209
<pre>
210 4 laforge
[42995.786699] wanpipe1: E1 connected!
211 1 laforge
[42995.789324] wanpipe1: AFT communications enabled
212
[42995.791333] wanpipe1: AFT Global TDM Intr
213
[42995.791410] wanpipe1: TDM Timing Disabled!
214
[42996.811333] wanpipe1: Enable E1 Interrupts 
215
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)