Project

General

Profile

Sangoma Wanpipe DAHDI » History » Revision 6

Revision 5 (laforge, 12/30/2021 09:05 AM) → Revision 6/7 (laforge, 12/30/2021 11:47 AM)

h1. Sangoma Wanpipe DAHDI 

 {{>toc}} 

 some random notes on bulding DAHDI drivers for Sangoma AFT104 cards on a modern Debian 11 / buster 

 h2. Sources 

 * wanpipe 7.0.34 (e.g. via https://git.osmocom.org/wanpipe) 
 * dahdi-linux (e.g. https://github.com/osmocom/dahdi-linux) 

 h2. Building  

 h3. the offiial way 

 some incredible convolution of shell scripts, c programs, perl script    and other bits and pieces, which all fail in various ways. 

 h3. the manual way 

 # build + install dahdi-linux 
 #* usual make + sudo make install 

 h4. h3. building sangoma wanpipe drivers 

 <pre> 
 $ cp ~/dahdi-linux/drivers/dahdi/Module.symvers ~/wanpipe/patches/kdrivers/src/net 
 $ make -j4 dahdi DAHDI_DIR=/home/laforge/dahdi-linux KBUILD_EXTRA_SYMBOLS=/home/laforge/dahdi-linux/drivers/dahdi/Module.symvers 
 </pre> 

 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: 

 This somehow fails, the Module.symvers gets overwritten and the module fails with various related errors: 
 <pre> 
 [ 4874.442680] wanpipe: no symbol version for dahdi_hdlc_putbuf 
 [ 4874.442702] wanpipe: Unknown symbol dahdi_hdlc_putbuf (err -22) 
 [ 4874.442754] wanpipe: no symbol version for _dahdi_ec_span 
 [ 4874.442760] wanpipe: Unknown symbol _dahdi_ec_span (err -22) 
 .. 
 </pre> 

 h2. Building (using Makefile.debian11) 

 In the osmocom wanpipe git repo at    https://git.osmocom.org/wanpipe/ we've added a @Makefile.debian@ which will help you in building + installing a lean/minimal driver set. 

 It supports two targets: 
 * @build@ (default, compiles kernel driver and minimal userspae lib+tool) 
 * @install@ (installs the kernel driver, library and userspace tool) 

 h2. Loading of kernel drivers 

 This assumes that If you have installed want to manually load the kernel modules (both DAHDI and wanpipe) and exeuted depmod. 

 
 * @modprobe dahdi@ (assumption is that dahdi is already installed to @/lib/modules/@) 
 * @modprobe wanpipe@ from within@wanpipe/patches/kdrivers/src/net@ 
 * @modprobe wanec@ ** @insmod sdladrv.ko@ 
 ** @insmod wanrouter.ko@ 
 ** @insmod wanpipe.ko@ 
 ** @insmod wanec.ko@ 

 you should then see something like this below (my system has two AFT-104-SH cards installed): 

 <pre> 
 [ 5890.715722] WANPIPE(tm) Multi-Protocol WAN Driver Module 7.0.34.0 (c) 1994-2016 Sangoma Technologies Inc 
 [ 5890.715732] wanpipe: Probing for WANPIPE hardware. 
 [ 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 
 [ 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 
 [ 5890.716665] wanpipe: Allocating maximum 8 devices: wanpipe1 - wanpipe8. 
 [ 5890.719054] WANPIPE: TDM Codecs Initialized 
 </pre> 

 equally there should now be a lot of /proc/net/wanrouter/ files 

 <pre> 
 $ cat /proc/net/wanrouter/hwprobe 
 ------------------------------- 
 | Wanpipe Hardware Probe Info | 
 ------------------------------- 
 1 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=1 : HWEC=128 : V=26 
 2 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=2 : HWEC=128 : V=26 
 3 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=3 : HWEC=128 : V=26 
 4 . AFT-A104-SH : SLOT=0 : BUS=2 : IRQ=25 : CPU=A : PORT=4 : HWEC=128 : V=26 
 5 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=1 : HWEC=128 : V=26 
 6 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=2 : HWEC=128 : V=26 
 7 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=3 : HWEC=128 : V=26 
 8 . AFT-A104-SH : SLOT=1 : BUS=2 : IRQ=27 : CPU=A : PORT=4 : HWEC=128 : V=26 

 Sangoma Card Count: A104=2  
 </pre> 

 h2. Configuration of wanpipe kernel drivers 

 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. 

 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. 

 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. 

 h3. /etc/wanpipe/wanpipeX.conf file 

 I'm using the following example for @/etc/wanpipe/wanpipe1.conf@: 
 <pre> 

 [devices] 
 wanpipe1 = WAN_AFT_TE1, Comment 

 [interfaces] 
 w1g1 = wanpipe1, , TDM_VOICE, Comment 

 [wanpipe1] 
 CARD_TYPE         = AFT 
 S514CPU           = A 
 CommPort          = PRI 
 AUTO_PCISLOT      = NO 
 PCISLOT           = 0 
 PCIBUS            = 2 
 FE_MEDIA          = E1 
 FE_LCODE          = HDB3 
 FE_FRAME          = CRC4 
 FE_LINE           = 1 
 TE_CLOCK          = NORMAL 
 TE_REF_CLOCK      = 0 
 ACTIVE_CH         = ALL 
 TE_HIGHIMPEDANCE          = NO 
 LBO               = NONE 
 FE_TXTRISTATE     = NO 
 MTU               = 1500 
 UDPPORT           = 9000 
 TTL               = 255 
 IGNORE_FRONT_END = NO 
 TDMV_SPAN         = 1 
 TDMV_DCHAN        = 15 

 [w1g1] 
 ACTIVE_CH         = ALL 
 TDMV_ECHO_OFF     = NO 
 </pre> 

 Note: You will need to fill the PCISLOT, PCIBUS etc. parameters according to your output pf /proc/net/wanrouter/hwprobe. 

 h3. Applying the configuration to the kernel 

 @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: 

 <pre> 
 [42799.010236] Processing WAN device wanpipe1... 
 [42799.010249] wanpipe1: Locating: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0 
 [42799.010266] wanpipe1: Found: A101/1D/2/2D/4/4D/8/8D/16/16D card, CPU A, PciBus=2, PciSlot=0, Port=0 
 [42799.010379] wanpipe1: AFT PCI memory at 0xFE500000 
 [42799.010386] wanpipe1: IRQ 25 allocated to the AFT PCI card 
 [42799.010465] wanpipe1: Starting AFT 2/4/8 Hardware Init. 
 [42799.010506] wanpipe1: Enabling front end link monitor 
 [42799.010516] wanpipe1: Global Chip Configuration: used=1 used_type=1 
 [42799.013910] wanpipe1: AFT Data Mux Bit Map: 0x01234567 
 [42799.013946] wanpipe1: Defaulting E1 LBO          = 120 OH 
 [42799.013951] wanpipe1: Defaulting E1 Signalling = CCS 
 [42799.013957] wanpipe1: Configuring PMC COMET-QUAD E1 FE 
 [42799.013965] wanpipe1:      Port 1,HDB3,CRC4,120OH 
 [42799.013972] wanpipe1:      Clk Normal:0, Ch FFFFFFFF 
 [42799.013977] wanpipe1:      Sig Mode CCS 
 [42799.182498] wanpipe1: Front end successful 
 [42799.182506] wanpipe1: Configuring FE Line=1 Clock Source: Line=1 Normal 
 [42799.182741] wanpipe1: Front End Interface Ready 0x40000000 
 [42799.182756] wanpipe1: Register EC interface wanec1 (usage 1, max ec chans 128)! 
 [42799.182774] wanpipe1: Configuring Device     :wanpipe1    FrmVr=26 
 [42799.182777] wanpipe1:      Global MTU       = 1500 
 [42799.182780] wanpipe1:      Global MRU       = 1500 
 [42799.182784] wanpipe1:      Data Mux Map     = 0x01234567 
 [42799.182786] wanpipe1:      Rx CRC Bytes     = 0 
 [42799.182789] wanpipe1:      RBS Signalling = Off 
 [42799.182793] wanpipe1:      Global TDM Int = Enabled 
 [42799.182796] wanpipe1:      Global TDM Ring= HW Ring 
 [42799.182799] wanpipe1:      Global SPAN IRQ= RX/TX 
 [42799.182802] wanpipe1:      TDM HW TONE      = Disabled 
 [42799.182806] wanpipe1:      Fifo Trigger     = rx:50 tx:50 (events per sec) 
 [42799.182809] wanpipe1:      TDMV Span        = 1 : Enabled 
 [42799.182812] wanpipe1:      TDMV Dummy       = Disabled 
 [42799.182816] wanpipe1:      RTP TAP          = Disabled 
 [42799.182915] wanpipe1: Initializing TE1 Voice functions 
 [42799.183149] wanpipe1:      Global Poll IRQ= Disabled 
 [42799.183157] wanpipe1: Configuring Interface: w1g1 
 [42799.183173] wanpipe1: w1g1 Running in TDM Voice Zaptel Mode. 
 [42799.183180] wanpipe1:      Fifo Level Map:0x01041040 
 [42799.183188] wanpipe1:      MRU             :8 (Chunk/Period=80/10) 
 [42799.183192] wanpipe1:      MTU             :8 (Chunk/Period=80/10) 
 [42799.183196] wanpipe1:      HDLC Eng        :Off (Transparent) | N/A 
 [42799.183203] wanpipe1:      Data Mux Ctrl :On 
 [42799.183206] wanpipe1:      Active Ch Map :0x00000002 
 [42799.183210] wanpipe1:      First TSlot     :1 
 [42799.183257] wanpipe1:      DMA/Len/Idle/ChainR/ChainT/EC :65/1024/8/Off/Off/Off 
 [42799.183263] wanpipe1:      Memory: Chan=5680 
 [42799.183504] wanpipe1: Configuring Interface: w1g1 (log supress) 
 [42799.183519] wanpipe1:      Active Ch Map :0x00000004 
 [42799.183523] wanpipe1:      First TSlot     :2 
 [42799.183756] wanpipe1: Configuring Interface: w1g1 (log supress) 
 [42799.183772] wanpipe1:      Active Ch Map :0x00000008 
 [42799.183775] wanpipe1:      First TSlot     :3 
 ... 
 [42799.192799] wanpipe1: Configuring Interface: w1g1 (log supress) 
 [42799.192858] wanpipe1: Configuring TDMV Master dev w1g1 
 [42799.192868] wanpipe1:      Active Ch Map :0x80000000 
 [42799.192872] wanpipe1:      First TSlot     :31 
 [42799.202242] wanpipe1: Wanpipe device is registered to Zaptel span # 1! 
 [42799.209532] wanpipe1: TDM Timing Enabled 1 ms 
 [42800.205759] wanpipe1: E1 disconnected! 
 </pre> 

 Equally, you will get a @/proc/dahdi/1@ device for that first E1 span. 

 h3. Connecting E1 

 Once your E1 link is up, you will get: 

 <pre> 
 [42995.786699] wanpipe1: E1 connected! 
 [42995.789324] wanpipe1: AFT communications enabled 
 [42995.791333] wanpipe1: AFT Global TDM Intr 
 [42995.791410] wanpipe1: TDM Timing Disabled! 
 [42996.811333] wanpipe1: Enable E1 Interrupts  
 </pre>
Add picture from clipboard (Maximum size: 48.8 MB)