Browse Source

remove unmaintained externel kernel modules

Waldemar Brodkorb 11 years ago
parent
commit
20341b4098

+ 0 - 39
package/rtsp/Makefile

@@ -1,39 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-include ${TOPDIR}/rules.mk
-
-PKG_NAME:=		rtsp
-PKG_VERSION:=		1.0
-PKG_RELEASE:=		1
-PKG_MD5SUM:=		92bb09883dd8a77ec5cfbff1c8932b15
-PKG_DESCR:=		connection tracking for RTSP
-PKG_SECTION:=		kernel
-PKG_DEPENDS:=           kmod-ip-nf-iptables kmod-nf-conntrack
-PKG_URL:=		http://github.com/maru-sama/rtsp-linux-v2.6
-
-PKG_CFLINE_RTSP:=	depends on !ADK_TOOLCHAIN_ONLY
-PKG_ARCH_DEPENDS:=	!arm
-
-NO_DISTFILES:=          1
-
-include ${TOPDIR}/mk/package.mk
-
-$(eval $(call PKG_template,RTSP_KMOD,rtsp-kmod,${KERNEL_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION}))
-
-CONFIG_STYLE:=		manual
-BUILD_STYLE:=		manual
-INSTALL_STYLE:=		manual
-
-pre-build:
-	$(MAKE) -C ${WRKBUILD} $(KERNEL_MODULE_FLAGS) all
-
-do-install:
-	${INSTALL_DIR} ${IDIR_RTSP_KMOD}/etc/modules.d/
-	echo "nf_conntrack_rtsp" > ${IDIR_RTSP_KMOD}/etc/modules.d/60-nf-nat-rtsp
-	echo "nf_nat_rtsp" >> ${IDIR_RTSP_KMOD}/etc/modules.d/60-nf-nat-rtsp
-	${INSTALL_DIR} ${IDIR_RTSP_KMOD}/lib/modules/${KERNEL_VERSION}/
-	${INSTALL_DATA} ${WRKBUILD}/*.ko \
-		${IDIR_RTSP_KMOD}/lib/modules/${KERNEL_VERSION}
-
-include ${TOPDIR}/mk/pkg-bottom.mk

+ 0 - 24
package/rtsp/src/Makefile

@@ -1,24 +0,0 @@
-ifneq ($(KERNELRELEASE),)
-# kbuild part of makefile
-ifndef CONFIG_NF_CONNTRACK
-$(error ** You need to enable NF_CONNTRACK in your kernel **)
-endif
-
-obj-m := nf_conntrack_rtsp.o nf_nat_rtsp.o
-else
-
-# Normal Makefile
-
-all: 
-	$(MAKE) -C $(KERNELDIR) M=`pwd` modules
-
-debug:
-	$(MAKE) -C $(KERNELDIR) EXTRA_CFLAGS=-DDEBUG M=`pwd` modules
-
-modules_install:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` modules_install
-
-clean:
-	rm -rf *.o *.ko *.mod.c .*.cmd Module.symvers modules.order .tmp_versions
-
-endif

+ 0 - 40
package/rtsp/src/README.rst

@@ -1,40 +0,0 @@
-Disclaimer: 
-===========
-
-This software is provided as is. I take no responsibility if it destroys your
-data or opens up a security hole on your firewall. That said, I have yet to
-hear something about this happening.
-
-I did not create this code myself, most was written by Tom Marshall, later on
-Harald Welte and then Steven van Acker ported it to the new 2.6 netfilter API.
-I just picked up this code in 2007 and made it compile and hopefully work with
-the new changed netfilter API.
-
-Bugs: 
-=====
-
-Of course there are. One of the most important ones, is that you MUST NOT
-filter outgoing connections otherwise the reply packes go missing. I tried to
-figure out, why the _expect call is not taking care of the outgoing connections
-but I was not able to figure this out. I gladly welcome patches that fix this
-and other bugs.
-
-Build Instructions: 
-===================
-
-Have the kernel source ready in some place and NF_CONNTRACK_NAT enabled in the
-configuration otherwise you will get an error during make. The Kbuild setup
-looks in /lib/modules/\`uname -r\`/build for the source. 
-
-If the source is located in another place set the KERNELDIR environment
-variable accordingly.
-
-After that a:
-
-	* make 
-	* make modules_install (as root)
-
-should be enough.  
-Then do a "modprobe nf_nat_rtsp" as root and try to connect to a RTSP
-service.
-

+ 0 - 133
package/rtsp/src/netfilter_helpers.h

@@ -1,133 +0,0 @@
-/*
- * Helpers for netfiler modules.  This file provides implementations for basic
- * functions such as strncasecmp(), etc.
- *
- * gcc will warn for defined but unused functions, so we only include the
- * functions requested.  The following macros are used:
- *   NF_NEED_STRNCASECMP        nf_strncasecmp()
- *   NF_NEED_STRTOU16           nf_strtou16()
- *   NF_NEED_STRTOU32           nf_strtou32()
- */
-#ifndef _NETFILTER_HELPERS_H
-#define _NETFILTER_HELPERS_H
-
-/* Only include these functions for kernel code. */
-#ifdef __KERNEL__
-
-#include <linux/ctype.h>
-#define iseol(c) ( (c) == '\r' || (c) == '\n' )
-
-/*
- * The standard strncasecmp()
- */
-#ifdef NF_NEED_STRNCASECMP
-static int
-nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
-{
-    if (s1 == NULL || s2 == NULL)
-    {
-        if (s1 == NULL && s2 == NULL)
-        {
-            return 0;
-        }
-        return (s1 == NULL) ? -1 : 1;
-    }
-    while (len > 0 && tolower(*s1) == tolower(*s2))
-    {
-        len--;
-        s1++;
-        s2++;
-    }
-    return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
-}
-#endif /* NF_NEED_STRNCASECMP */
-
-/*
- * Parse a string containing a 16-bit unsigned integer.
- * Returns the number of chars used, or zero if no number is found.
- */
-#ifdef NF_NEED_STRTOU16
-static int
-nf_strtou16(const char* pbuf, u_int16_t* pval)
-{
-    int n = 0;
-
-    *pval = 0;
-    while (isdigit(pbuf[n]))
-    {
-        *pval = (*pval * 10) + (pbuf[n] - '0');
-        n++;
-    }
-
-    return n;
-}
-#endif /* NF_NEED_STRTOU16 */
-
-/*
- * Parse a string containing a 32-bit unsigned integer.
- * Returns the number of chars used, or zero if no number is found.
- */
-#ifdef NF_NEED_STRTOU32
-static int
-nf_strtou32(const char* pbuf, u_int32_t* pval)
-{
-    int n = 0;
-
-    *pval = 0;
-    while (pbuf[n] >= '0' && pbuf[n] <= '9')
-    {
-        *pval = (*pval * 10) + (pbuf[n] - '0');
-        n++;
-    }
-
-    return n;
-}
-#endif /* NF_NEED_STRTOU32 */
-
-/*
- * Given a buffer and length, advance to the next line and mark the current
- * line.
- */
-#ifdef NF_NEED_NEXTLINE
-static int
-nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
-{
-    uint    off = *poff;
-    uint    physlen = 0;
-
-    if (off >= len)
-    {
-        return 0;
-    }
-
-    while (p[off] != '\n')
-    {
-        if (len-off <= 1)
-        {
-            return 0;
-        }
-
-        physlen++;
-        off++;
-    }
-
-    /* if we saw a crlf, physlen needs adjusted */
-    if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
-    {
-        physlen--;
-    }
-
-    /* advance past the newline */
-    off++;
-
-    *plineoff = *poff;
-    *plinelen = physlen;
-    *poff = off;
-
-    return 1;
-}
-#endif /* NF_NEED_NEXTLINE */
-
-#endif /* __KERNEL__ */
-
-#endif /* _NETFILTER_HELPERS_H */

+ 0 - 89
package/rtsp/src/netfilter_mime.h

@@ -1,89 +0,0 @@
-/*
- * MIME functions for netfilter modules.  This file provides implementations
- * for basic MIME parsing.  MIME headers are used in many protocols, such as
- * HTTP, RTSP, SIP, etc.
- *
- * gcc will warn for defined but unused functions, so we only include the
- * functions requested.  The following macros are used:
- *   NF_NEED_MIME_NEXTLINE      nf_mime_nextline()
- */
-#ifndef _NETFILTER_MIME_H
-#define _NETFILTER_MIME_H
-
-/* Only include these functions for kernel code. */
-#ifdef __KERNEL__
-
-#include <linux/ctype.h>
-
-/*
- * Given a buffer and length, advance to the next line and mark the current
- * line.  If the current line is empty, *plinelen will be set to zero.  If
- * not, it will be set to the actual line length (including CRLF).
- *
- * 'line' in this context means logical line (includes LWS continuations).
- * Returns 1 on success, 0 on failure.
- */
-#ifdef NF_NEED_MIME_NEXTLINE
-static int
-nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
-{
-    uint    off = *poff;
-    uint    physlen = 0;
-    int     is_first_line = 1;
-
-    if (off >= len)
-    {
-        return 0;
-    }
-
-    do
-    {
-        while (p[off] != '\n')
-        {
-            if (len-off <= 1)
-            {
-                return 0;
-            }
-
-            physlen++;
-            off++;
-        }
-
-        /* if we saw a crlf, physlen needs adjusted */
-        if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
-        {
-            physlen--;
-        }
-
-        /* advance past the newline */
-        off++;
-
-        /* check for an empty line */
-        if (physlen == 0)
-        {
-            break;
-        }
-
-        /* check for colon on the first physical line */
-        if (is_first_line)
-        {
-            is_first_line = 0;
-            if (memchr(p+(*poff), ':', physlen) == NULL)
-            {
-                return 0;
-            }
-        }
-    }
-    while (p[off] == ' ' || p[off] == '\t');
-
-    *plineoff = *poff;
-    *plinelen = (physlen == 0) ? 0 : (off - *poff);
-    *poff = off;
-
-    return 1;
-}
-#endif /* NF_NEED_MIME_NEXTLINE */
-
-#endif /* __KERNEL__ */
-
-#endif /* _NETFILTER_MIME_H */

+ 0 - 521
package/rtsp/src/nf_conntrack_rtsp.c

@@ -1,521 +0,0 @@
-/*
- * RTSP extension for IP connection tracking
- * (C) 2003 by Tom Marshall <tmarshall at real.com>
- * based on ip_conntrack_irc.c
- *
- *      This program is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU General Public License
- *      as published by the Free Software Foundation; either version
- *      2 of the License, or (at your option) any later version.
- *
- * Module load syntax:
- *   insmod nf_conntrack_rtsp.o ports=port1,port2,...port<MAX_PORTS>
- *                              max_outstanding=n setup_timeout=secs
- *
- * If no ports are specified, the default will be port 554.
- *
- * With max_outstanding you can define the maximum number of not yet
- * answered SETUP requests per RTSP session (default 8).
- * With setup_timeout you can specify how long the system waits for
- * an expected data channel (default 300 seconds).
- *
- * 2005-02-13: Harald Welte <laforge at netfilter.org>
- * 	- port to 2.6
- * 	- update to recent post-2.6.11 api changes
- * 2006-09-14: Steven Van Acker <deepstar at singularity.be>
- *      - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack
- * 2007-04-18: Michael Guntsche <mike at it-loops.com>
- * 			- Port to new NF API
- */
-
-#include <linux/module.h>
-#include <linux/netfilter.h>
-#include <linux/ip.h>
-#include <linux/inet.h>
-#include <net/tcp.h>
-
-#include <net/netfilter/nf_conntrack.h>
-#include <net/netfilter/nf_conntrack_expect.h>
-#include <net/netfilter/nf_conntrack_helper.h>
-#include "nf_conntrack_rtsp.h"
-
-#define NF_NEED_STRNCASECMP
-#define NF_NEED_STRTOU16
-#define NF_NEED_STRTOU32
-#define NF_NEED_NEXTLINE
-#include "netfilter_helpers.h"
-#define NF_NEED_MIME_NEXTLINE
-#include "netfilter_mime.h"
-
-#include <linux/ctype.h>
-#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */
-
-#define MAX_PORTS 8
-static int ports[MAX_PORTS];
-static int num_ports = 0;
-static int max_outstanding = 8;
-static unsigned int setup_timeout = 300;
-
-MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
-MODULE_DESCRIPTION("RTSP connection tracking module");
-MODULE_LICENSE("GPL");
-module_param_array(ports, int, &num_ports, 0400);
-MODULE_PARM_DESC(ports, "port numbers of RTSP servers");
-module_param(max_outstanding, int, 0400);
-MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session");
-module_param(setup_timeout, int, 0400);
-MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels");
-
-static char *rtsp_buffer;
-static DEFINE_SPINLOCK(rtsp_buffer_lock);
-
-static struct nf_conntrack_expect_policy rtsp_exp_policy; 
-
-unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
-				 enum ip_conntrack_info ctinfo,
-				 unsigned int protoff,
-				 unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp,
-				 struct nf_conntrack_expect *exp);
-void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
-
-EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook);
-
-/*
- * Max mappings we will allow for one RTSP connection (for RTP, the number
- * of allocated ports is twice this value).  Note that SMIL burns a lot of
- * ports so keep this reasonably high.  If this is too low, you will see a
- * lot of "no free client map entries" messages.
- */
-#define MAX_PORT_MAPS 16
-
-/*** default port list was here in the masq code: 554, 3030, 4040 ***/
-
-#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
-
-/*
- * Parse an RTSP packet.
- *
- * Returns zero if parsing failed.
- *
- * Parameters:
- *  IN      ptcp        tcp data pointer
- *  IN      tcplen      tcp data len
- *  IN/OUT  ptcpoff     points to current tcp offset
- *  OUT     phdrsoff    set to offset of rtsp headers
- *  OUT     phdrslen    set to length of rtsp headers
- *  OUT     pcseqoff    set to offset of CSeq header
- *  OUT     pcseqlen    set to length of CSeq header
- */
-static int
-rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff,
-                   uint* phdrsoff, uint* phdrslen,
-                   uint* pcseqoff, uint* pcseqlen,
-                   uint* transoff, uint* translen)
-{
-	uint    entitylen = 0;
-	uint    lineoff;
-	uint    linelen;
-	
-	if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen))
-		return 0;
-	
-	*phdrsoff = *ptcpoff;
-	while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) {
-		if (linelen == 0) {
-			if (entitylen > 0)
-				*ptcpoff += min(entitylen, tcplen - *ptcpoff);
-			break;
-		}
-		if (lineoff+linelen > tcplen) {
-			pr_info("!! overrun !!\n");
-			break;
-		}
-		
-		if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) {
-			*pcseqoff = lineoff;
-			*pcseqlen = linelen;
-		} 
-
-		if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) {
-			*transoff = lineoff;
-			*translen = linelen;
-		}
-		
-		if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) {
-			uint off = lineoff+15;
-			SKIP_WSPACE(ptcp+lineoff, linelen, off);
-			nf_strtou32(ptcp+off, &entitylen);
-		}
-	}
-	*phdrslen = (*ptcpoff) - (*phdrsoff);
-	
-	return 1;
-}
-
-/*
- * Find lo/hi client ports (if any) in transport header
- * In:
- *   ptcp, tcplen = packet
- *   tranoff, tranlen = buffer to search
- *
- * Out:
- *   pport_lo, pport_hi = lo/hi ports (host endian)
- *
- * Returns nonzero if any client ports found
- *
- * Note: it is valid (and expected) for the client to request multiple
- * transports, so we need to parse the entire line.
- */
-static int
-rtsp_parse_transport(char* ptran, uint tranlen,
-                     struct ip_ct_rtsp_expect* prtspexp)
-{
-	int     rc = 0;
-	uint    off = 0;
-	
-	if (tranlen < 10 || !iseol(ptran[tranlen-1]) ||
-	    nf_strncasecmp(ptran, "Transport:", 10) != 0) {
-		pr_info("sanity check failed\n");
-		return 0;
-	}
-	
-	pr_debug("tran='%.*s'\n", (int)tranlen, ptran);
-	off += 10;
-	SKIP_WSPACE(ptran, tranlen, off);
-	
-	/* Transport: tran;field;field=val,tran;field;field=val,... */
-	while (off < tranlen) {
-		const char* pparamend;
-		uint        nextparamoff;
-		
-		pparamend = memchr(ptran+off, ',', tranlen-off);
-		pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
-		nextparamoff = pparamend-ptran;
-		
-		while (off < nextparamoff) {
-			const char* pfieldend;
-			uint        nextfieldoff;
-			
-			pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-			nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-		   
-			if (strncmp(ptran+off, "client_port=", 12) == 0) {
-				u_int16_t   port;
-				uint        numlen;
-		    
-				off += 12;
-				numlen = nf_strtou16(ptran+off, &port);
-				off += numlen;
-				if (prtspexp->loport != 0 && prtspexp->loport != port)
-					pr_debug("multiple ports found, port %hu ignored\n", port);
-				else {
-					pr_debug("lo port found : %hu\n", port);
-					prtspexp->loport = prtspexp->hiport = port;
-					if (ptran[off] == '-') {
-						off++;
-						numlen = nf_strtou16(ptran+off, &port);
-						off += numlen;
-						prtspexp->pbtype = pb_range;
-						prtspexp->hiport = port;
-						
-						// If we have a range, assume rtp:
-						// loport must be even, hiport must be loport+1
-						if ((prtspexp->loport & 0x0001) != 0 ||
-						    prtspexp->hiport != prtspexp->loport+1) {
-							pr_debug("incorrect range: %hu-%hu, correcting\n",
-							       prtspexp->loport, prtspexp->hiport);
-							prtspexp->loport &= 0xfffe;
-							prtspexp->hiport = prtspexp->loport+1;
-						}
-					} else if (ptran[off] == '/') {
-						off++;
-						numlen = nf_strtou16(ptran+off, &port);
-						off += numlen;
-						prtspexp->pbtype = pb_discon;
-						prtspexp->hiport = port;
-					}
-					rc = 1;
-				}
-			}
-			
-			/*
-			 * Note we don't look for the destination parameter here.
-			 * If we are using NAT, the NAT module will handle it.  If not,
-			 * and the client is sending packets elsewhere, the expectation
-			 * will quietly time out.
-			 */
-			
-			off = nextfieldoff;
-		}
-		
-		off = nextparamoff;
-	}
-	
-	return rc;
-}
-
-void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp)
-{
-		typeof(nf_nat_rtsp_hook_expectfn) nf_nat_rtsp_expectfn;
-		nf_nat_rtsp_expectfn = rcu_dereference(nf_nat_rtsp_hook_expectfn);
-    if(nf_nat_rtsp_expectfn && ct->master->status & IPS_NAT_MASK) {
-        nf_nat_rtsp_expectfn(ct,exp);
-    }
-}
-
-/*** conntrack functions ***/
-
-/* outbound packet: client->server */
-
-static inline int
-help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen,
-         struct nf_conn *ct, enum ip_conntrack_info ctinfo, 
-         unsigned int protoff)
-{
-	struct ip_ct_rtsp_expect expinfo;
-	
-	int dir = CTINFO2DIR(ctinfo);   /* = IP_CT_DIR_ORIGINAL */
-	//struct  tcphdr* tcph = (void*)iph + iph->ihl * 4;
-	//uint    tcplen = pktlen - iph->ihl * 4;
-	char*   pdata = rb_ptr;
-	//uint    datalen = tcplen - tcph->doff * 4;
-	uint    dataoff = 0;
-	int ret = NF_ACCEPT;
-	
-	struct nf_conntrack_expect *exp;
-	
-	__be16 be_loport;
-	
-	typeof(nf_nat_rtsp_hook) nf_nat_rtsp;
-
-	memset(&expinfo, 0, sizeof(expinfo));
-	
-	while (dataoff < datalen) {
-		uint    cmdoff = dataoff;
-		uint    hdrsoff = 0;
-		uint    hdrslen = 0;
-		uint    cseqoff = 0;
-		uint    cseqlen = 0;
-		uint    transoff = 0;
-		uint    translen = 0;
-		uint    off;
-		
-		if (!rtsp_parse_message(pdata, datalen, &dataoff,
-					&hdrsoff, &hdrslen,
-					&cseqoff, &cseqlen,
-					&transoff, &translen))
-			break;      /* not a valid message */
-		
-		if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0)
-			continue;   /* not a SETUP message */
-		pr_debug("found a setup message\n");
-
-		off = 0;
-		if(translen) {
-			rtsp_parse_transport(pdata+transoff, translen, &expinfo);
-		}
-
-		if (expinfo.loport == 0) {
-			pr_debug("no udp transports found\n");
-			continue;   /* no udp transports found */
-		}
-
-		pr_debug("udp transport found, ports=(%d,%hu,%hu)\n",
-		       (int)expinfo.pbtype, expinfo.loport, expinfo.hiport);
-
-		exp = nf_ct_expect_alloc(ct);
-		if (!exp) {
-			ret = NF_DROP;
-			goto out;
-		}
-
-		be_loport = htons(expinfo.loport);
-
-		nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
-			&ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3,
-			IPPROTO_UDP, NULL, &be_loport); 
-
-		exp->master = ct;
-
-		exp->expectfn = expected;
-		exp->flags = 0;
-
-		if (expinfo.pbtype == pb_range) {
-			pr_debug("Changing expectation mask to handle multiple ports\n");
-			//exp->mask.dst.u.udp.port  = 0xfffe;
-		}
-
-		pr_debug("expect_related %pI4:%u-%pI4:%u\n",
-		       &exp->tuple.src.u3.ip,
-		       ntohs(exp->tuple.src.u.udp.port),
-		       &exp->tuple.dst.u3.ip,
-		       ntohs(exp->tuple.dst.u.udp.port));
-
-		nf_nat_rtsp = rcu_dereference(nf_nat_rtsp_hook);
-		if (nf_nat_rtsp && ct->status & IPS_NAT_MASK)
-			/* pass the request off to the nat helper */
-			ret = nf_nat_rtsp(skb, ctinfo, protoff, hdrsoff, hdrslen, &expinfo, exp);
-		else if (nf_ct_expect_related(exp) != 0) {
-			pr_info("nf_conntrack_expect_related failed\n");
-			ret  = NF_DROP;
-		}
-		nf_ct_expect_put(exp);
-		goto out;
-	}
-out:
-
-	return ret;
-}
-
-
-static inline int
-help_in(struct sk_buff *skb, size_t pktlen,
- struct nf_conn* ct, enum ip_conntrack_info ctinfo)
-{
- return NF_ACCEPT;
-}
-
-static int help(struct sk_buff *skb, unsigned int protoff,
-		struct nf_conn *ct, enum ip_conntrack_info ctinfo) 
-{
-	struct tcphdr _tcph, *th;
-	unsigned int dataoff, datalen;
-	char *rb_ptr;
-	int ret = NF_DROP;
-
-	/* Until there's been traffic both ways, don't look in packets. */
-	if (ctinfo != IP_CT_ESTABLISHED && 
-	    ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
-		pr_debug("conntrackinfo = %u\n", ctinfo);
-		return NF_ACCEPT;
-	} 
-
-	/* Not whole TCP header? */
-	th = skb_header_pointer(skb,protoff, sizeof(_tcph), &_tcph);
-
-	if (!th)
-		return NF_ACCEPT;
-   
-	/* No data ? */
-	dataoff = protoff + th->doff*4;
-	datalen = skb->len - dataoff;
-	if (dataoff >= skb->len)
-		return NF_ACCEPT;
-
-	spin_lock_bh(&rtsp_buffer_lock);
-	rb_ptr = skb_header_pointer(skb, dataoff,
-				    skb->len - dataoff, rtsp_buffer);
-	BUG_ON(rb_ptr == NULL);
-
-#if 0
-	/* Checksum invalid?  Ignore. */
-	/* FIXME: Source route IP option packets --RR */
-	if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr,
-			 csum_partial((char*)tcph, tcplen, 0)))
-	{
-		DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n",
-		       tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
-		return NF_ACCEPT;
-	}
-#endif
-
-	switch (CTINFO2DIR(ctinfo)) {
-	case IP_CT_DIR_ORIGINAL:
-		ret = help_out(skb, rb_ptr, datalen, ct, ctinfo, protoff);
-		break;
-	case IP_CT_DIR_REPLY:
-		pr_debug("IP_CT_DIR_REPLY\n");
-		/* inbound packet: server->client */
-		ret = NF_ACCEPT;
-		break;
-	}
-
-	spin_unlock_bh(&rtsp_buffer_lock);
-
-	return ret;
-}
-
-static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS];
-static char rtsp_names[MAX_PORTS][10];
-
-/* This function is intentionally _NOT_ defined as __exit */
-static void
-fini(void)
-{
-	int i;
-	for (i = 0; i < num_ports; i++) {
-		pr_debug("unregistering port %d\n", ports[i]);
-		nf_conntrack_helper_unregister(&rtsp_helpers[i]);
-	}
-	kfree(rtsp_buffer);
-}
-
-static int __init
-init(void)
-{
-	int i, ret;
-	struct nf_conntrack_helper *hlpr;
-	char *tmpname;
-
-	printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n");
-
-	if (max_outstanding < 1) {
-		printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n");
-		return -EBUSY;
-	}
-	if (setup_timeout < 0) {
-		printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n");
-		return -EBUSY;
-	}
-
-  rtsp_exp_policy.max_expected = max_outstanding;
-  rtsp_exp_policy.timeout = setup_timeout;
-	
-	rtsp_buffer = kmalloc(65536, GFP_KERNEL);
-	if (!rtsp_buffer) 
-		return -ENOMEM;
-
-	/* If no port given, default to standard rtsp port */
-	if (ports[0] == 0) {
-		ports[0] = RTSP_PORT;
-	}
-
-	for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
-		hlpr = &rtsp_helpers[i];
-		memset(hlpr, 0, sizeof(struct nf_conntrack_helper));
-		hlpr->tuple.src.l3num = AF_INET;
-		hlpr->tuple.src.u.tcp.port = htons(ports[i]);
-		hlpr->tuple.dst.protonum = IPPROTO_TCP;
-		//hlpr->mask.src.u.tcp.port = 0xFFFF;
-		//hlpr->mask.dst.protonum = 0xFF;
-		hlpr->expect_policy = &rtsp_exp_policy;
-		hlpr->me = THIS_MODULE;
-		hlpr->help = help;
-
-		tmpname = &rtsp_names[i][0];
-		if (ports[i] == RTSP_PORT) {
-			sprintf(tmpname, "rtsp");
-		} else {
-			sprintf(tmpname, "rtsp-%d", i);
-		}
-		strlcpy(hlpr->name, tmpname, sizeof(hlpr->name));
-
-		pr_debug("port #%d: %d\n", i, ports[i]);
-
-		ret = nf_conntrack_helper_register(hlpr);
-
-		if (ret) {
-			printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]);
-			fini();
-			return -EBUSY;
-		}
-		num_ports++;
-	}
-	return 0;
-}
-
-module_init(init);
-module_exit(fini);
-
-EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn);
-

+ 0 - 64
package/rtsp/src/nf_conntrack_rtsp.h

@@ -1,64 +0,0 @@
-/*
- * RTSP extension for IP connection tracking.
- * (C) 2003 by Tom Marshall <tmarshall at real.com>
- * based on ip_conntrack_irc.h
- *
- *      This program is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU General Public License
- *      as published by the Free Software Foundation; either version
- *      2 of the License, or (at your option) any later version.
- */
-#ifndef _IP_CONNTRACK_RTSP_H
-#define _IP_CONNTRACK_RTSP_H
-
-//#define IP_NF_RTSP_DEBUG 1
-#define IP_NF_RTSP_VERSION "0.6.21"
-
-#ifdef __KERNEL__
-/* port block types */
-typedef enum {
-    pb_single,  /* client_port=x */
-    pb_range,   /* client_port=x-y */
-    pb_discon   /* client_port=x/y (rtspbis) */
-} portblock_t;
-
-/* We record seq number and length of rtsp headers here, all in host order. */
-
-/*
- * This structure is per expected connection.  It is a member of struct
- * ip_conntrack_expect.  The TCP SEQ for the conntrack expect is stored
- * there and we are expected to only store the length of the data which
- * needs replaced.  If a packet contains multiple RTSP messages, we create
- * one expected connection per message.
- *
- * We use these variables to mark the entire header block.  This may seem
- * like overkill, but the nature of RTSP requires it.  A header may appear
- * multiple times in a message.  We must treat two Transport headers the
- * same as one Transport header with two entries.
- */
-struct ip_ct_rtsp_expect
-{
-    u_int32_t   len;        /* length of header block */
-    portblock_t pbtype;     /* Type of port block that was requested */
-    u_int16_t   loport;     /* Port that was requested, low or first */
-    u_int16_t   hiport;     /* Port that was requested, high or second */
-#if 0
-    uint        method;     /* RTSP method */
-    uint        cseq;       /* CSeq from request */
-#endif
-};
-
-extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
-				 enum ip_conntrack_info ctinfo,
-				 unsigned int protoff,
-				 unsigned int matchoff, unsigned int matchlen,
-				 struct ip_ct_rtsp_expect *prtspexp,
-				 struct nf_conntrack_expect *exp);
-
-extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
-
-#define RTSP_PORT   554
-
-#endif /* __KERNEL__ */
-
-#endif /* _IP_CONNTRACK_RTSP_H */

+ 0 - 488
package/rtsp/src/nf_nat_rtsp.c

@@ -1,488 +0,0 @@
-/*
- * RTSP extension for TCP NAT alteration
- * (C) 2003 by Tom Marshall <tmarshall at real.com>
- * based on ip_nat_irc.c
- *
- *      This program is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU General Public License
- *      as published by the Free Software Foundation; either version
- *      2 of the License, or (at your option) any later version.
- *
- * Module load syntax:
- *      insmod nf_nat_rtsp.o ports=port1,port2,...port<MAX_PORTS>
- *                           stunaddr=<address>
- *                           destaction=[auto|strip|none]
- *
- * If no ports are specified, the default will be port 554 only.
- *
- * stunaddr specifies the address used to detect that a client is using STUN.
- * If this address is seen in the destination parameter, it is assumed that
- * the client has already punched a UDP hole in the firewall, so we don't
- * mangle the client_port.  If none is specified, it is autodetected.  It
- * only needs to be set if you have multiple levels of NAT.  It should be
- * set to the external address that the STUN clients detect.  Note that in
- * this case, it will not be possible for clients to use UDP with servers
- * between the NATs.
- *
- * If no destaction is specified, auto is used.
- *   destaction=auto:  strip destination parameter if it is not stunaddr.
- *   destaction=strip: always strip destination parameter (not recommended).
- *   destaction=none:  do not touch destination parameter (not recommended).
- */
-
-#include <linux/module.h>
-#include <net/tcp.h>
-#include <net/netfilter/nf_nat.h>
-#include <net/netfilter/nf_nat_helper.h>
-#include "nf_conntrack_rtsp.h"
-#include <net/netfilter/nf_conntrack_expect.h>
-
-#include <linux/inet.h>
-#include <linux/ctype.h>
-#define NF_NEED_STRNCASECMP
-#define NF_NEED_STRTOU16
-#include "netfilter_helpers.h"
-#define NF_NEED_MIME_NEXTLINE
-#include "netfilter_mime.h"
-
-#define MAX_PORTS       8
-#define DSTACT_AUTO     0
-#define DSTACT_STRIP    1
-#define DSTACT_NONE     2
-
-static char*    stunaddr = NULL;
-static char*    destaction = NULL;
-
-static u_int32_t extip = 0;
-static int       dstact = 0;
-
-MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
-MODULE_DESCRIPTION("RTSP network address translation module");
-MODULE_LICENSE("GPL");
-module_param(stunaddr, charp, 0644);
-MODULE_PARM_DESC(stunaddr, "Address for detecting STUN");
-module_param(destaction, charp, 0644);
-MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)");
-
-#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
-
-/*** helper functions ***/
-
-static void
-get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen)
-{
-    struct iphdr*   iph  = ip_hdr(skb);
-    struct tcphdr*  tcph = (void *)iph + ip_hdrlen(skb);
-
-    *pptcpdata = (char*)tcph +  tcph->doff*4;
-    *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata;
-}
-
-/*** nat functions ***/
-
-/*
- * Mangle the "Transport:" header:
- *   - Replace all occurences of "client_port=<spec>"
- *   - Handle destination parameter
- *
- * In:
- *   ct, ctinfo = conntrack context
- *   skb        = packet
- *   tranoff    = Transport header offset from TCP data
- *   tranlen    = Transport header length (incl. CRLF)
- *   rport_lo   = replacement low  port (host endian)
- *   rport_hi   = replacement high port (host endian)
- *
- * Returns packet size difference.
- *
- * Assumes that a complete transport header is present, ending with CR or LF
- */
-static int
-rtsp_mangle_tran(enum ip_conntrack_info ctinfo, unsigned int protoff,
-                 struct nf_conntrack_expect* exp,
-								 struct ip_ct_rtsp_expect* prtspexp,
-                 struct sk_buff* skb, uint tranoff, uint tranlen)
-{
-    char*       ptcp;
-    uint        tcplen;
-    char*       ptran;
-    char        rbuf1[16];      /* Replacement buffer (one port) */
-    uint        rbuf1len;       /* Replacement len (one port) */
-    char        rbufa[16];      /* Replacement buffer (all ports) */
-    uint        rbufalen;       /* Replacement len (all ports) */
-    u_int32_t   newip;
-    u_int16_t   loport, hiport;
-    uint        off = 0;
-    uint        diff;           /* Number of bytes we removed */
-
-    struct nf_conn *ct = exp->master;
-    struct nf_conntrack_tuple *t;
-
-    char    szextaddr[15+1];
-    uint    extaddrlen;
-    int     is_stun;
-
-    get_skb_tcpdata(skb, &ptcp, &tcplen);
-    ptran = ptcp+tranoff;
-
-    if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen ||
-        tranlen < 10 || !iseol(ptran[tranlen-1]) ||
-        nf_strncasecmp(ptran, "Transport:", 10) != 0)
-    {
-        pr_info("sanity check failed\n");
-        return 0;
-    }
-    off += 10;
-    SKIP_WSPACE(ptcp+tranoff, tranlen, off);
-
-    newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
-    t = &exp->tuple;
-    t->dst.u3.ip = newip;
-
-    extaddrlen = extip ? sprintf(szextaddr, "%pI4", &extip)
-                       : sprintf(szextaddr, "%pI4", &newip);
-    pr_debug("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto"));
-
-    rbuf1len = rbufalen = 0;
-    switch (prtspexp->pbtype)
-    {
-    case pb_single:
-        for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
-        {
-            t->dst.u.udp.port = htons(loport);
-            if (nf_ct_expect_related(exp) == 0)
-            {
-                pr_debug("using port %hu\n", loport);
-                break;
-            }
-        }
-        if (loport != 0)
-        {
-            rbuf1len = sprintf(rbuf1, "%hu", loport);
-            rbufalen = sprintf(rbufa, "%hu", loport);
-        }
-        break;
-    case pb_range:
-        for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */
-        {
-            t->dst.u.udp.port = htons(loport);
-            if (nf_ct_expect_related(exp) == 0)
-            {
-                hiport = loport + 1; //~exp->mask.dst.u.udp.port;
-                pr_debug("using ports %hu-%hu\n", loport, hiport);
-                break;
-            }
-        }
-        if (loport != 0)
-        {
-            rbuf1len = sprintf(rbuf1, "%hu", loport);
-            rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1);
-        }
-        break;
-    case pb_discon:
-        for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
-        {
-            t->dst.u.udp.port = htons(loport);
-            if (nf_ct_expect_related(exp) == 0)
-            {
-                pr_debug("using port %hu (1 of 2)\n", loport);
-                break;
-            }
-        }
-        for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */
-        {
-            t->dst.u.udp.port = htons(hiport);
-            if (nf_ct_expect_related(exp) == 0)
-            {
-                pr_debug("using port %hu (2 of 2)\n", hiport);
-                break;
-            }
-        }
-        if (loport != 0 && hiport != 0)
-        {
-            rbuf1len = sprintf(rbuf1, "%hu", loport);
-            if (hiport == loport+1)
-            {
-                rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport);
-            }
-            else
-            {
-                rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport);
-            }
-        }
-        break;
-    }
-
-    if (rbuf1len == 0)
-    {
-        return 0;   /* cannot get replacement port(s) */
-    }
-
-    /* Transport: tran;field;field=val,tran;field;field=val,... */
-    while (off < tranlen)
-    {
-        uint        saveoff;
-        const char* pparamend;
-        uint        nextparamoff;
-
-        pparamend = memchr(ptran+off, ',', tranlen-off);
-        pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
-        nextparamoff = pparamend-ptcp;
-
-        /*
-         * We pass over each param twice.  On the first pass, we look for a
-         * destination= field.  It is handled by the security policy.  If it
-         * is present, allowed, and equal to our external address, we assume
-         * that STUN is being used and we leave the client_port= field alone.
-         */
-        is_stun = 0;
-        saveoff = off;
-        while (off < nextparamoff)
-        {
-            const char* pfieldend;
-            uint        nextfieldoff;
-
-            pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-            nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-
-            if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0)
-            {
-                if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0)
-                {
-                    is_stun = 1;
-                }
-                if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
-                {
-                    diff = nextfieldoff-off;
-                    if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
-                                                         off, diff, NULL, 0))
-                    {
-                        /* mangle failed, all we can do is bail */
-			nf_ct_unexpect_related(exp);
-                        return 0;
-                    }
-                    get_skb_tcpdata(skb, &ptcp, &tcplen);
-                    ptran = ptcp+tranoff;
-                    tranlen -= diff;
-                    nextparamoff -= diff;
-                    nextfieldoff -= diff;
-                }
-            }
-
-            off = nextfieldoff;
-        }
-        if (is_stun)
-        {
-            continue;
-        }
-        off = saveoff;
-        while (off < nextparamoff)
-        {
-            const char* pfieldend;
-            uint        nextfieldoff;
-
-            pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-            nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-
-            if (strncmp(ptran+off, "client_port=", 12) == 0)
-            {
-                u_int16_t   port;
-                uint        numlen;
-                uint        origoff;
-                uint        origlen;
-                char*       rbuf    = rbuf1;
-                uint        rbuflen = rbuf1len;
-
-                off += 12;
-                origoff = (ptran-ptcp)+off;
-                origlen = 0;
-                numlen = nf_strtou16(ptran+off, &port);
-                off += numlen;
-                origlen += numlen;
-                if (port != prtspexp->loport)
-                {
-                    pr_debug("multiple ports found, port %hu ignored\n", port);
-                }
-                else
-                {
-                    if (ptran[off] == '-' || ptran[off] == '/')
-                    {
-                        off++;
-                        origlen++;
-                        numlen = nf_strtou16(ptran+off, &port);
-                        off += numlen;
-                        origlen += numlen;
-                        rbuf = rbufa;
-                        rbuflen = rbufalen;
-                    }
-
-                    /*
-                     * note we cannot just memcpy() if the sizes are the same.
-                     * the mangle function does skb resizing, checks for a
-                     * cloned skb, and updates the checksums.
-                     *
-                     * parameter 4 below is offset from start of tcp data.
-                     */
-                    diff = origlen-rbuflen;
-                    if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
-                                              origoff, origlen, rbuf, rbuflen))
-                    {
-                        /* mangle failed, all we can do is bail */
-			nf_ct_unexpect_related(exp);
-                        return 0;
-                    }
-                    get_skb_tcpdata(skb, &ptcp, &tcplen);
-                    ptran = ptcp+tranoff;
-                    tranlen -= diff;
-                    nextparamoff -= diff;
-                    nextfieldoff -= diff;
-                }
-            }
-
-            off = nextfieldoff;
-        }
-
-        off = nextparamoff;
-    }
-
-    return 1;
-}
-
-static uint
-help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff,
-	 unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, 
-	 struct nf_conntrack_expect* exp)
-{
-    char*   ptcp;
-    uint    tcplen;
-    uint    hdrsoff;
-    uint    hdrslen;
-    uint    lineoff;
-    uint    linelen;
-    uint    off;
-
-    //struct iphdr* iph = (struct iphdr*)(*pskb)->nh.iph;
-    //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4);
-
-    get_skb_tcpdata(skb, &ptcp, &tcplen);
-    hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq);
-    hdrslen = matchlen;
-    off = hdrsoff;
-    pr_debug("NAT rtsp help_out\n");
-
-    while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen))
-    {
-        if (linelen == 0)
-        {
-            break;
-        }
-        if (off > hdrsoff+hdrslen)
-        {
-            pr_info("!! overrun !!");
-            break;
-        }
-        pr_debug("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
-
-        if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0)
-        {
-            uint oldtcplen = tcplen;
-	    pr_debug("hdr: Transport\n");
-            if (!rtsp_mangle_tran(ctinfo, protoff, exp, prtspexp, skb, lineoff, linelen))
-            {
-		pr_debug("hdr: Transport mangle failed");
-                break;
-            }
-            get_skb_tcpdata(skb, &ptcp, &tcplen);
-            hdrslen -= (oldtcplen-tcplen);
-            off -= (oldtcplen-tcplen);
-            lineoff -= (oldtcplen-tcplen);
-            linelen -= (oldtcplen-tcplen);
-            pr_debug("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
-        }
-    }
-
-    return NF_ACCEPT;
-}
-
-static unsigned int
-help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff,
-     unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
-     struct nf_conntrack_expect* exp)
-{
-    int dir = CTINFO2DIR(ctinfo);
-    int rc = NF_ACCEPT;
-
-    switch (dir)
-    {
-    case IP_CT_DIR_ORIGINAL:
-        rc = help_out(skb, ctinfo, protoff, matchoff, matchlen, prtspexp, exp);
-        break;
-    case IP_CT_DIR_REPLY:
-	pr_debug("unmangle ! %u\n", ctinfo);
-    	/* XXX: unmangle */
-	rc = NF_ACCEPT;
-        break;
-    }
-    //UNLOCK_BH(&ip_rtsp_lock);
-
-    return rc;
-}
-
-static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
-{
-    struct nf_nat_range range;
-    union nf_inet_addr newdstip, newsrcip, newip;
-
-    struct nf_conn *master = ct->master;
-
-    newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3;
-    newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3;
-    //FIXME (how to port that ?)
-    //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip;
-    newip = newdstip;
-
-    pr_debug("newsrcip=%pI4, newdstip=%pI4, newip=%pI4\n",
-           &newsrcip.ip, &newdstip.ip, &newip.ip);
-
-    // We don't want to manip the per-protocol, just the IPs. 
-    range.flags = NF_NAT_RANGE_MAP_IPS;
-    range.min_addr = range.max_addr = newip;
-
-    nf_nat_setup_info(ct, &range, NF_NAT_MANIP_DST);
-}
-
-
-static void __exit fini(void)
-{
-	nf_nat_rtsp_hook = NULL;
-        nf_nat_rtsp_hook_expectfn = NULL;
-	synchronize_net();
-}
-
-static int __init init(void)
-{
-	printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
-
-	BUG_ON(nf_nat_rtsp_hook);
-	nf_nat_rtsp_hook = help;
-        nf_nat_rtsp_hook_expectfn = &expected;
-
-	if (stunaddr != NULL)
-		extip = in_aton(stunaddr);
-
-	if (destaction != NULL) {
-	        if (strcmp(destaction, "auto") == 0)
-			dstact = DSTACT_AUTO;
-
-		if (strcmp(destaction, "strip") == 0)
-			dstact = DSTACT_STRIP;
-
-		if (strcmp(destaction, "none") == 0)
-			dstact = DSTACT_NONE;
-	}
-
-	return 0;
-}
-
-module_init(init);
-module_exit(fini);

+ 0 - 33
package/sangam-atm/Config.in.manual

@@ -1,33 +0,0 @@
-config ADK_COMPILE_SANGAM_ATM
-	tristate
-	depends on ADK_PACKAGE_KMOD_SANGAM_ATM
-	default n
-
-config ADK_PACKAGE_KMOD_SANGAM_ATM
-	prompt "kmod-sangam-atm........ DSL modem driver for TI AR7 boards"
-	tristate
-	depends on ADK_LINUX_MIPS_AG241
-	default n
-	select ADK_KPACKAGE_KMOD_FW_LOADER
-	select ADK_KPACKAGE_KMOD_ATM
-	select ADK_COMPILE_SANGAM_ATM
-	help
-	  DSL modem driver for TI AR7 boards
-
-choice
-prompt "Firmware type"
-depends on ADK_PACKAGE_KMOD_SANGAM_ATM
-
-config ADK_PACKAGE_SANGAM_ATM_ANNEX_B
-       prompt "Annex B, ADSL over ISDN"
-       boolean
-       help
-
-config ADK_PACKAGE_SANGAM_ATM_ANNEX_A
-       prompt "Annex A, ADSL over POTS"
-       boolean
-       help
-
-endchoice
-
-

+ 0 - 43
package/sangam-atm/Makefile

@@ -1,43 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-include ${TOPDIR}/rules.mk
-
-PKG_NAME:=		sangam-atm
-PKG_VERSION:=		1.0
-PKG_RELEASE:=		1
-PKG_MD5SUM:=		3843f3e670967fe81561770ac960c1cd
-PKG_DESCR:=		DSL modem driver for TI AR7 boards
-PKG_SECTION:=		kernel
-PKG_DEPENDS:=		kmod-fw-loader kmod-atm
-PKG_SITES:=		http://openadk.org/distfiles/
-
-include ${TOPDIR}/mk/package.mk
-include ${TOPDIR}/mk/kernel-vars.mk
-
-$(eval $(call PKG_template,KMOD_SANGAM_ATM,kmod-sangam-atm,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
-
-CONFIG_STYLE:=          manual
-BUILD_STYLE:=           manual
-INSTALL_STYLE:=         manual
-
-do-build:
-	${KERNEL_MAKE_ENV} $(MAKE) ${KERNEL_MAKE_OPTS} LDFLAGS="" SUBDIRS="${WRKBUILD}" modules
-
-do-install:
-	${INSTALL_DIR} ${IDIR_KMOD_SANGAM_ATM}/etc/modules.d/
-	echo "tiatm" > ${IDIR_KMOD_SANGAM_ATM}/etc/modules.d/70-sangam-atm
-	${INSTALL_DIR} ${IDIR_KMOD_SANGAM_ATM}/lib/modules/${KERNEL_VERSION}/
-	${INSTALL_DATA} ${WRKBUILD}/tiatm.ko \
-		${IDIR_KMOD_SANGAM_ATM}/lib/modules/${KERNEL_VERSION}
-	${INSTALL_DIR} ${IDIR_KMOD_SANGAM_ATM}/lib/firmware
-ifeq (${ADK_PACKAGE_SANGAM_ATM_ANNEX_A},y)
-	${INSTALL_DATA} ${WRKBUILD}/ar0700mp.bin \
-		${IDIR_KMOD_SANGAM_ATM}/lib/firmware/ar0700xx.bin
-endif
-ifeq (${ADK_PACKAGE_SANGAM_ATM_ANNEX_B},y)
-	${INSTALL_DATA} ${WRKBUILD}/ar0700db.bin \
-		${IDIR_KMOD_SANGAM_ATM}/lib/firmware/ar0700xx.bin
-endif
-
-include ${TOPDIR}/mk/pkg-bottom.mk

+ 0 - 29
package/sangam-atm/patches/patch-Makefile

@@ -1,29 +0,0 @@
---- sangam-atm-1.0.orig/Makefile	2005-06-01 05:46:28.000000000 +0200
-+++ sangam-atm-1.0/Makefile	2009-12-17 19:10:13.456420379 +0100
-@@ -1,18 +1,11 @@
--# File: drivers/atm/ti_evm3/Makefile
--#
--# Makefile for the Texas Instruments EVM3 ADSL/ATM driver.
- #
-+# Makefile for the TIATM device driver.
- #
--# Copyright (c) 2000 Texas Instruments Incorporated.
--# 	Jeff Harrell (jharrell@telogy.com)
--# 	Viren Balar  (vbalar@ti.com)
--# 	Victor Wells (vwells@telogy.com)
--#
--include $(TOPDIR)/Rules.make
--
--
--
--
--
--
- 
-+CONFIG_SANGAM_ATM=m
-+#EXTRA_CFLAGS += -DEL -I. -DPOST_SILICON -DCOMMON_NSP -DCONFIG_LED_MODULE -DDEREGISTER_LED -DNO_ACT
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -DNO_ACT -D__NO__VOICE_PATCH__ -DEL
-+#EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL
-+EXTRA_CFLAGS += -DEL -I$(PWD) -DPOST_SILICON -DCOMMON_NSP -D__NO__VOICE_PATCH__ -DEL -DCPATM_TASKLET_MODE
-+obj-$(CONFIG_SANGAM_ATM) := tiatm.o
-+tiatm-objs += cpsar.o aal5sar.o tn7sar.o tn7atm.o tn7dsl.o dsl_hal_api.o dsl_hal_support.o dsl_hal_advcfg.o

+ 0 - 8
package/sangam-atm/patches/patch-cp_sar_reg_h

@@ -1,8 +0,0 @@
---- sangam-atm-1.0.orig/cp_sar_reg.h	2004-04-20 08:23:30.000000000 +0200
-+++ sangam-atm-1.0/cp_sar_reg.h	2009-12-17 19:25:17.702739456 +0100
-@@ -214,4 +214,4 @@
- 
- /* END OF FILE */
- 
--#endif _INC_SAR_REG
-+#endif

+ 0 - 11
package/sangam-atm/patches/patch-cppi_cpaal5_c

@@ -1,11 +0,0 @@
---- sangam-atm-1.0.orig/cppi_cpaal5.c	2005-04-08 10:22:04.000000000 +0200
-+++ sangam-atm-1.0/cppi_cpaal5.c	2009-12-17 19:09:41.516423269 +0100
-@@ -352,7 +352,7 @@ static int halRxReturn(HAL_RECEIVEINFO *
-            {
-             /* malloc failed, add this RCB to Needs Buffer List */
-             TempRcb->FragCount = 1;                                             /*MJH+030417*/
--            (HAL_RCB *)TempRcb->Eop = TempRcb;                                  /* GSG +030430 */
-+            TempRcb->Eop = TempRcb;                                             /* GSG +030430 */
- 
-             if(HalDev->NeedsCount < MAX_NEEDS)                                  /* +MJH 030410 */
-               {                                                                 /* +MJH 030410 */

+ 0 - 11
package/sangam-atm/patches/patch-dev_host_interface_h

@@ -1,11 +0,0 @@
---- sangam-atm-1.0.orig/dev_host_interface.h	2007-03-07 14:40:14.000000000 +0100
-+++ sangam-atm-1.0/dev_host_interface.h	2009-12-17 19:27:01.156438308 +0100
-@@ -1288,7 +1288,7 @@ typedef struct
- 
-   SINT16 devCodecRxdf4Coeff[12] ;             // (BOTH) IIR Coefficients
-   SINT16 devCodecTxdf2aCoeff[64] ;            // (BOTH) FIR filter coefficients
--#if OHIO_SUPPORT
-+#if defined(OHIO_SUPPORT)
-   SINT16 devCodecTxdf2bCoeff[84] ;            // (BOTH) FIR filter coefficients
- #else
-   SINT16 devCodecTxdf2bCoeff[64] ;            // (BOTH) FIR filter coefficients

+ 0 - 15
package/sangam-atm/patches/patch-dsl_hal_advcfg_c

@@ -1,15 +0,0 @@
---- sangam-atm-1.0.orig/dsl_hal_advcfg.c	2005-08-09 09:20:46.000000000 +0200
-+++ sangam-atm-1.0/dsl_hal_advcfg.c	2009-12-17 19:09:58.440420854 +0100
-@@ -36,9 +36,9 @@
- *    05Jul05     0.00.09            CPH    CQ9775: Change dslhal_advcfg_configDsTones input parameters & support for ADSL2+
- *    24Jul05     0.00.10            CPH    Fixed comments in dslhal_advcfg_configDsTones function header
- *******************************************************************************/
--#include <dev_host_interface.h>
--#include <dsl_hal_register.h>
--#include <dsl_hal_support.h>
-+#include "dev_host_interface.h"
-+#include "dsl_hal_register.h"
-+#include "dsl_hal_support.h"
- 
- /*****************************************************************************/
- /* ACT API functions -- To be moved into their own independent module --RamP */

+ 0 - 107
package/sangam-atm/patches/patch-dsl_hal_api_c

@@ -1,107 +0,0 @@
---- sangam-atm-1.0.orig/dsl_hal_api.c	2007-03-07 04:13:06.000000000 +0100
-+++ sangam-atm-1.0/dsl_hal_api.c	2009-12-17 19:39:11.092420102 +0100
-@@ -254,15 +254,15 @@
- *                            of phyEnableDisableWord & phyControlWord to avoid changing API struct
- *                            which may cause change required to application data structure.
- ******************************************************************************/
--#include <dev_host_interface.h>
--#include <dsl_hal_register.h>
--#include <dsl_hal_support.h>
-+#include "dev_host_interface.h"
-+#include "dsl_hal_register.h"
-+#include "dsl_hal_support.h"
- 
- #ifndef NO_ADV_STATS
--#include <dsl_hal_logtable.h>
-+#include "dsl_hal_logtable.h"
- #endif
- 
--#include <dsl_hal_version.h>
-+#include "dsl_hal_version.h"
- 
- //  UR8_MERGE_START CQ11054   Jack Zhang
- static unsigned int highprecision_selected = 0;  //By default we use low precision for backward compt.
-@@ -958,9 +958,6 @@ int dslhal_api_pollTrainingStatus(tidsl_
- 
-   /*char *tmp;*/
-   DEV_HOST_dspOamSharedInterface_t *pdspOamSharedInterface, dspOamSharedInterface;
--#if SWTC
--  DEV_HOST_tcHostCommDef_t          TCHostCommDef;
--#endif
- 
-   dgprintf(5,"dslhal_api_pollTrainingStatus\n");
-   pdspOamSharedInterface = (DEV_HOST_dspOamSharedInterface_t *) ptidsl->pmainAddr;
-@@ -971,17 +968,6 @@ int dslhal_api_pollTrainingStatus(tidsl_
-     dgprintf(1,"dslhal_support_blockRead failed\n");
-     return DSLHAL_ERROR_BLOCK_READ;
-   }
--#if SWTC
--  dspOamSharedInterface.tcHostComm_p =(DEV_HOST_tcHostCommDef_t *) dslhal_support_byteSwap32((unsigned int)dspOamSharedInterface.tcHostComm_p);
--
--  rc = dslhal_support_blockRead((PVOID)dspOamSharedInterface.tcHostComm_p,
--                                &TCHostCommDef, sizeof(DEV_HOST_tcHostCommDef_t));
--  if (rc)
--  {
--    dgprintf(1,"dslhal_support_blockRead failed\n");
--    return DSLHAL_ERROR_BLOCK_READ;
--  }
--#endif
- 
-   rc = dslhal_support_processTrainingState(ptidsl);
-   if(rc)
-@@ -1025,9 +1011,6 @@ int dslhal_api_handleTrainingInterrupt(t
- 
-   /*char *tmp;*/
-   DEV_HOST_dspOamSharedInterface_t *pdspOamSharedInterface, dspOamSharedInterface;
--#if SWTC
--  DEV_HOST_tcHostCommDef_t          TCHostCommDef;
--#endif
-   dgprintf(6,"dslhal_api_handleTrainingInterrupt\n");
-   pdspOamSharedInterface = (DEV_HOST_dspOamSharedInterface_t *) ptidsl->pmainAddr;
-   rc = dslhal_support_blockRead(pdspOamSharedInterface, &dspOamSharedInterface,
-@@ -1037,17 +1020,6 @@ int dslhal_api_handleTrainingInterrupt(t
-     dgprintf(1,"dslhal_support_blockRead failed\n");
-     return DSLHAL_ERROR_BLOCK_READ;
-   }
--#if SWTC
--  dspOamSharedInterface.tcHostComm_p =(DEV_HOST_tcHostCommDef_t *) dslhal_support_byteSwap32((unsigned int)dspOamSharedInterface.tcHostComm_p);
--
--  rc = dslhal_support_blockRead((PVOID)dspOamSharedInterface.tcHostComm_p,
--                                &TCHostCommDef, sizeof(DEV_HOST_tcHostCommDef_t));
--  if (rc)
--  {
--    dgprintf(1,"dslhal_support_blockRead failed\n");
--    return DSLHAL_ERROR_BLOCK_READ;
--  }
--#endif
- 
-   if(intrSource & MASK_BITFIELD_INTERRUPTS)
-   {
-@@ -1705,27 +1677,15 @@ void dslhal_api_gatherStatistics(tidsl_t
-       /* Get ATM Stats for both US and DS for Channel 0*/
-       ptidsl->AppData.usAtm_count[0]     = dslhal_support_byteSwap32(usAtmStats0.goodCount);
-       ptidsl->AppData.usIdle_count[0]    = dslhal_support_byteSwap32(usAtmStats0.idleCount);
--#if SWTC
--      ptidsl->AppData.usPdu_count[0]     = dslhal_support_byteSwap32(usAtmStats0.pduCount);
--#endif
-       ptidsl->AppData.dsGood_count[0]    = dslhal_support_byteSwap32(dsAtmStats0.goodCount);
-       ptidsl->AppData.dsIdle_count[0]    = dslhal_support_byteSwap32(dsAtmStats0.idleCount);
--#if SWTC
--      ptidsl->AppData.dsPdu_count[0]     = dslhal_support_byteSwap32(dsAtmStats0.pduCount);
--#endif
-       ptidsl->AppData.dsBadHec_count[0]  = dslhal_support_byteSwap32((dsAtmStats0.badHecCount));
-       ptidsl->AppData.dsOVFDrop_count[0] = dslhal_support_byteSwap32((dsAtmStats0.ovflwDropCount));
-       /* Get ATM Stats for both US and DS for Channel 1*/
-       ptidsl->AppData.usAtm_count[1]     = dslhal_support_byteSwap32(usAtmStats1.goodCount);
-       ptidsl->AppData.usIdle_count[1]    = dslhal_support_byteSwap32(usAtmStats1.idleCount);
--#if SWTC
--      ptidsl->AppData.usPdu_count[1]     = dslhal_support_byteSwap32(usAtmStats1.pduCount);
--#endif
-       ptidsl->AppData.dsGood_count[1]    = dslhal_support_byteSwap32(dsAtmStats1.goodCount);
-       ptidsl->AppData.dsIdle_count[1]    = dslhal_support_byteSwap32(dsAtmStats1.idleCount);
--#if SWTC
--      ptidsl->AppData.dsPdu_count[1]     = dslhal_support_byteSwap32(dsAtmStats1.pduCount);
--#endif
-       ptidsl->AppData.dsBadHec_count[1]  = dslhal_support_byteSwap32((dsAtmStats1.badHecCount));
-       ptidsl->AppData.dsOVFDrop_count[1] = dslhal_support_byteSwap32((dsAtmStats1.ovflwDropCount));
- 

+ 0 - 52
package/sangam-atm/patches/patch-dsl_hal_support_c

@@ -1,52 +0,0 @@
---- sangam-atm-1.0.orig/dsl_hal_support.c	2007-05-18 09:47:33.000000000 +0200
-+++ sangam-atm-1.0/dsl_hal_support.c	2009-12-17 19:40:14.924421047 +0100
-@@ -140,9 +140,9 @@
- *                                          oamFeature are overriden
- // UR8_MERGE_END CQ10774 Ram
- *******************************************************************************/
--#include <dev_host_interface.h>
--#include <dsl_hal_register.h>
--#include <dsl_hal_support.h>
-+#include "dev_host_interface.h"
-+#include "dsl_hal_register.h"
-+#include "dsl_hal_support.h"
- 
- #define NUM_READ_RETRIES 3
- static unsigned int dslhal_support_adsl2ByteSwap32(unsigned int in32Bits);
-@@ -1665,9 +1665,6 @@ int dslhal_support_hostDspCodeDownload(t
-   unsigned char * image;
-   char *tmp = (char *)DEV_HOST_DSP_OAM_POINTER_LOCATION;
-   DEV_HOST_dspVersionDef_t        dspVersion;
--#if SWTC
--  DEV_HOST_tcHostCommDef_t        TCHostCommDef;
--#endif
-   DEV_HOST_oamWrNegoParaDef_t     OamWrNegoParaDef;
-   DEV_HOST_dspOamSharedInterface_t dspOamSharedInterface, *pdspOamSharedInterface;
-   DEV_HOST_olayDpDef_t            olayDpParms;
-@@ -2152,26 +2149,6 @@ int dslhal_support_hostDspCodeDownload(t
-     }
- 
-   /* table_dsp info */
--#if SWTC
--  dspOamSharedInterface.tcHostComm_p = (DEV_HOST_tcHostCommDef_t *)dslhal_support_byteSwap32((unsigned int)dspOamSharedInterface.tcHostComm_p);
--  rc = dslhal_support_blockRead(&pdspOamSharedInterface->tcHostComm_p,
--                                    &pTCHostCommDef, 4);
--  if (rc)
--    {
--    dgprintf(1,"dslhal_support_blockRead failed\n");
--    return DSLHAL_ERROR_BLOCK_READ;
--    }
--
--    pTCHostCommDef=(DEV_HOST_tcHostCommDef_t *) dslhal_support_byteSwap32((unsigned int)pTCHostCommDef);
--
--   rc = dslhal_support_blockRead((PVOID)dspOamSharedInterface.tcHostComm_p,
--                               &TCHostCommDef, sizeof(DEV_HOST_tcHostCommDef_t));
--  if (rc)
--    {
--    dgprintf(1,"dslhal_support_blockRead failed\n");
--    return DSLHAL_ERROR_BLOCK_READ;
--    }
--#endif
-   /* Select the Multimode Training */
-   dspOamSharedInterface.oamWriteNegoParams_p = (DEV_HOST_oamWrNegoParaDef_t *)dslhal_support_byteSwap32((unsigned int)dspOamSharedInterface.oamWriteNegoParams_p);
-   rc = dslhal_support_blockRead((PVOID)dspOamSharedInterface.oamWriteNegoParams_p, &OamWrNegoParaDef, sizeof(DEV_HOST_oamWrNegoParaDef_t));

+ 0 - 11
package/sangam-atm/patches/patch-dsl_hal_support_h

@@ -1,11 +0,0 @@
---- sangam-atm-1.0.orig/dsl_hal_support.h	2005-11-11 09:07:04.000000000 +0100
-+++ sangam-atm-1.0/dsl_hal_support.h	2009-12-17 19:09:41.532422794 +0100
-@@ -49,7 +49,7 @@
- *    04Nov05     0.11.00            CPH    Fixed T1413 mode got Zero DS/US rate when DSL_BIT_TMODE is set.
- *******************************************************************************/
- 
--#include <dsl_hal_api.h>
-+#include "dsl_hal_api.h"
- 
- #define virtual2Physical(a)    (((int)a)&~0xe0000000)
- /* External Function Prototype Declarations */

+ 0 - 17
package/sangam-atm/patches/patch-tn7api_h

@@ -1,17 +0,0 @@
---- sangam-atm-1.0.orig/tn7api.h	2006-12-11 15:36:54.000000000 +0100
-+++ sangam-atm-1.0/tn7api.h	2009-12-17 19:24:45.926721344 +0100
-@@ -107,7 +107,7 @@ int tn7dsl_proc_dbg_rmsgs4(char* buf, ch
- 
- int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
- int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
--inline int tn7dsl_handle_interrupt(void);
-+int tn7dsl_handle_interrupt(void);
- 
- void tn7dsl_dslmod_sysctl_register(void);
- void tn7dsl_dslmod_sysctl_unregister(void);
-@@ -173,4 +173,4 @@ void tn7sar_get_sar_firmware_version(uns
- int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data);
- int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data);
- int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip);
--#endif __SGAPI_H
-+#endif

+ 0 - 633
package/sangam-atm/patches/patch-tn7atm_c

@@ -1,633 +0,0 @@
---- sangam-atm-1.0.orig/tn7atm.c	2007-05-18 09:45:50.000000000 +0200
-+++ sangam-atm-1.0/tn7atm.c	2009-12-17 19:10:27.616421480 +0100
-@@ -61,7 +61,6 @@
-  *    UR8_MERGE_END   CQ11057*
- *********************************************************************************************/
- 
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -69,11 +68,20 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
-+
-+#include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-+
- #include "dsl_hal_api.h"
- #include "tn7atm.h"
- #include "tn7api.h"
-@@ -82,8 +90,149 @@
- #include "dsl_hal_register.h"
- 
- #ifdef MODULE
-+MODULE_LICENSE("GPL");
- MODULE_DESCRIPTION ("Tnetd73xx ATM Device Driver");
- MODULE_AUTHOR ("Zhicheng Tang");
-+
-+int mp_sar_ipacemax = -1;
-+module_param_named(ipacemax, mp_sar_ipacemax, int, 0);
-+MODULE_PARM_DESC(ipacemax, "Interrupt pacing");
-+
-+char *mp_macc = NULL;
-+module_param_named(macc, mp_macc, charp, 0);
-+MODULE_PARM_DESC(macc, "MAC address");
-+
-+int mp_dsp_noboost = -1;
-+module_param_named(dsp_noboost, mp_dsp_noboost, int, 0);
-+MODULE_PARM_DESC(dsp_noboost, "Suppress DSP frequency boost");
-+
-+int mp_dsp_freq = -1;
-+module_param_named(dsp_freq, mp_dsp_freq, int, 0);
-+MODULE_PARM_DESC(dsp_freq, "Frequency to boost the DSP to");
-+
-+char *mp_featctl0 = NULL;
-+module_param_named(featctl0, mp_featctl0, charp, 0);
-+MODULE_PARM_DESC(featctl0, "DSL feature control 0");
-+
-+char *mp_featctl1 = NULL;
-+module_param_named(featctl1, mp_featctl1, charp, 0);
-+MODULE_PARM_DESC(featctl1, "DSL feature control 1");
-+
-+char *mp_phyctl0 = NULL;
-+module_param_named(phyctl0, mp_phyctl0, charp, 0);
-+MODULE_PARM_DESC(phyctl0, "DSL PHY control 0");
-+
-+char *mp_phyctl1 = NULL;
-+module_param_named(phyctl1, mp_phyctl1, charp, 0);
-+MODULE_PARM_DESC(phyctl1, "DSL PHY control 1");
-+
-+int mp_turbodsl = -1;
-+module_param_named(turbodsl, mp_turbodsl, int, 0);
-+MODULE_PARM_DESC(turbodsl, "Enable TurboDSL");
-+
-+int mp_sar_rxbuf = -1;
-+module_param_named(sar_rxbuf, mp_sar_rxbuf, int, 0);
-+MODULE_PARM_DESC(sar_rxbuf, "SAR RxBuf size");
-+
-+int mp_sar_rxmax = -1;
-+module_param_named(sar_rxmax, mp_sar_rxmax, int, 0);
-+MODULE_PARM_DESC(sar_rxmax, "SAR RxMax size");
-+
-+int mp_sar_txbuf = -1;
-+module_param_named(sar_txbuf, mp_sar_txbuf, int, 0);
-+MODULE_PARM_DESC(sar_txbuf, "SAR TxBuf size");
-+
-+int mp_sar_txmax = -1;
-+module_param_named(sar_txmax, mp_sar_txmax, int, 0);
-+MODULE_PARM_DESC(sar_txmax, "SAR TxMax size");
-+
-+char *mp_modulation = NULL;
-+module_param_named(modulation, mp_modulation, charp, 0);
-+MODULE_PARM_DESC(modulation, "Modulation");
-+
-+int mp_fine_gain_control = -1;
-+module_param_named(fine_gain_control, mp_fine_gain_control, int, 0);
-+MODULE_PARM_DESC(fine_gain_control, "Fine gain control");
-+
-+int mp_fine_gain_value = -1;
-+module_param_named(fine_gain_value, mp_fine_gain_value, int, 0);
-+MODULE_PARM_DESC(fine_gain_value, "Fine gain value");
-+
-+int mp_enable_margin_retrain = -1;
-+module_param_named(enable_margin_retrain, mp_enable_margin_retrain, int, 0);
-+MODULE_PARM_DESC(enable_margin_retrain, "Enable margin retrain");
-+
-+int mp_margin_threshold = -1;
-+module_param_named(margin_threshold, mp_margin_threshold, int, 0);
-+MODULE_PARM_DESC(margin_threshold, "Margin retrain treshold");
-+
-+int mp_enable_rate_adapt = -1;
-+module_param_named(enable_rate_adapt, mp_enable_rate_adapt, int, 0);
-+MODULE_PARM_DESC(enable_rate_adapt, "Enable rate adaption");
-+
-+int mp_powercutback = -1;
-+module_param_named(powercutback, mp_powercutback, int, 0);
-+MODULE_PARM_DESC(powercutback, "Enable / disable powercutback");
-+
-+int mp_trellis = -1;
-+module_param_named(trellis, mp_trellis, int, 0);
-+MODULE_PARM_DESC(trellis, "Enable / disable trellis coding");
-+
-+int mp_bitswap = -1;
-+module_param_named(bitswap, mp_bitswap, int, 0);
-+MODULE_PARM_DESC(bitswap, "Enable / disable bitswap");
-+
-+int mp_maximum_bits_per_carrier = -1;
-+module_param_named(maximum_bits_per_carrier, mp_maximum_bits_per_carrier, int, 0);
-+MODULE_PARM_DESC(maximum_bits_per_carrier, "Maximum bits per carrier");
-+
-+int mp_maximum_interleave_depth = -1;
-+module_param_named(maximum_interleave_depth, mp_maximum_interleave_depth, int, 0);
-+MODULE_PARM_DESC(maximum_interleave_depth, "Maximum interleave depth");
-+
-+int mp_pair_selection = -1;
-+module_param_named(pair_selection, mp_pair_selection, int, 0);
-+MODULE_PARM_DESC(pair_selection, "Pair selection");
-+
-+int mp_dgas_polarity = -1;
-+module_param_named(dgas_polarity, mp_dgas_polarity, int, 0);
-+MODULE_PARM_DESC(dgas_polarity, "DGAS polarity");
-+
-+int mp_los_alarm = -1;
-+module_param_named(los_alarm, mp_los_alarm, int, 0);
-+MODULE_PARM_DESC(los_alarm, "LOS alarm");
-+
-+char *mp_eoc_vendor_id = NULL;
-+module_param_named(eoc_vendor_id, mp_eoc_vendor_id, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_id, "EOC vendor id");
-+
-+int mp_eoc_vendor_revision = -1;
-+module_param_named(eoc_vendor_revision, mp_eoc_vendor_revision, int, 0);
-+MODULE_PARM_DESC(eoc_vendor_revision, "EOC vendor revision");
-+
-+char *mp_eoc_vendor_serialnum = NULL;
-+module_param_named(eoc_vendor_serialnum, mp_eoc_vendor_serialnum, charp, 0);
-+MODULE_PARM_DESC(eoc_vendor_serialnum, "EOC vendor serial number");
-+
-+char *mp_invntry_vernum = NULL;
-+module_param_named(invntry_vernum, mp_invntry_vernum, charp, 0);
-+MODULE_PARM_DESC(invntry_vernum, "Inventory revision number");
-+
-+int mp_dsl_bit_tmode = -1;
-+module_param_named(dsl_bit_tmode, mp_dsl_bit_tmode, int, 0);
-+MODULE_PARM_DESC(dsl_bit_tmode, "DSL bit training mode");
-+
-+int mp_high_precision = -1;
-+module_param_named(high_precision, mp_high_precision, int, 0);
-+MODULE_PARM_DESC(high_precision, "High precision");
-+
-+int mp_autopvc_enable = -1;
-+module_param_named(autopvc_enable, mp_autopvc_enable, int, 0);
-+MODULE_PARM_DESC(autopvc_enable, "Enable / disable automatic PVC");
-+
-+int mp_oam_lb_timeout = -1;
-+module_param_named(oam_lb_timeout, mp_oam_lb_timeout, int, 0);
-+MODULE_PARM_DESC(oam_lb_timeout, "OAM LB timeout");
- #endif
- 
- #ifndef TRUE
-@@ -100,9 +249,9 @@ MODULE_AUTHOR ("Zhicheng Tang");
- 
- /*end of externs */
- 
--#ifndef TI_STATIC_ALLOCATIONS
--#define TI_STATIC_ALLOCATIONS
--#endif
-+//#ifndef TI_STATIC_ALLOCATIONS
-+//#define TI_STATIC_ALLOCATIONS
-+//#endif
- 
- #define tn7atm_kfree_skb(x)     dev_kfree_skb(x)
- 
-@@ -114,7 +263,7 @@ static int EnableQoS = FALSE;
- /* prototypes */
- static int tn7atm_set_can_support_adsl2 (int can);
- 
--static int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci);
-+static int tn7atm_open (struct atm_vcc *vcc);
- 
- static void tn7atm_close (struct atm_vcc *vcc);
- 
-@@ -257,13 +406,12 @@ static const struct atmdev_ops tn7atm_op
-         getsockopt:     NULL,
-         setsockopt:     NULL,
-         send:           tn7atm_send,
--        sg_send:        NULL,
-         phy_put:        NULL,
-         phy_get:        NULL,
-         change_qos:     tn7atm_change_qos,
- };
- 
--const char drv_proc_root_folder[] = "avalanche/";
-+const char drv_proc_root_folder[] = "avalanche";
- static struct proc_dir_entry *root_proc_dir_entry = NULL;
- #define DRV_PROC_MODE 0644
- static int proc_root_already_exists = TRUE;
-@@ -559,62 +707,12 @@ static int turbodsl_check_priority_type(
- 
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  *
-- *  Function: int tn7atm_walk_vccs(struct atm_dev *dev, short *vcc, int *vci)
-- *
-- *  Description: retrieve VPI/VCI for connection
-- *
-- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
--static int tn7atm_walk_vccs (struct atm_vcc *vcc, short *vpi, int *vci)
--{
--  struct atm_vcc *walk;
--
--  /*
--   * find a free VPI
--   */
--  if (*vpi == ATM_VPI_ANY)
--  {
--
--    for (*vpi = 0, walk = vcc->dev->vccs; walk; walk = walk->next)
--    {
--
--      if ((walk->vci == *vci) && (walk->vpi == *vpi))
--      {
--        (*vpi)++;
--        walk = vcc->dev->vccs;
--      }
--    }
--  }
--
--  /*
--   * find a free VCI
--   */
--  if (*vci == ATM_VCI_ANY)
--  {
--
--    for (*vci = ATM_NOT_RSV_VCI, walk = vcc->dev->vccs; walk;
--         walk = walk->next)
--    {
--
--      if ((walk->vpi = *vpi) && (walk->vci == *vci))
--      {
--        *vci = walk->vci + 1;
--        walk = vcc->dev->vccs;
--      }
--    }
--  }
--
--  return 0;
--}
--
--
--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- *
-  *  Function: int tn7atm_sar_irq(void)
-  *
-  *  Description: tnetd73xx SAR interrupt.
-  *
-  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
--static void tn7atm_sar_irq (int irq, void *voiddev, struct pt_regs *regs)
-+static irqreturn_t tn7atm_sar_irq (int irq, void *voiddev)
- {
-   struct atm_dev *atmdev;
-   Tn7AtmPrivate *priv;
-@@ -641,6 +739,7 @@ static void tn7atm_sar_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
-   psp_trace_par (ATM_DRV_SAR_ISR_EXIT, retval);
- #endif
-+  return IRQ_HANDLED;
- }
- 
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-@@ -650,7 +749,7 @@ static void tn7atm_sar_irq (int irq, voi
-  *  Description: tnetd73xx DSL interrupt.
-  *
-  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
--static void tn7atm_dsl_irq (int irq, void *voiddev, struct pt_regs *regs)
-+static irqreturn_t tn7atm_dsl_irq (int irq, void *voiddev)
- {
-   struct atm_dev *atmdev;
-   Tn7AtmPrivate *priv;
-@@ -672,6 +771,8 @@ static void tn7atm_dsl_irq (int irq, voi
- #ifdef TIATM_INST_SUPP
-   psp_trace_par (ATM_DRV_DSL_ISR_EXIT, retval);
- #endif
-+
-+  return IRQ_HANDLED;
- }
- 
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-@@ -693,25 +794,25 @@ static int __init tn7atm_irq_request (st
-    * Register SAR interrupt
-    */
-   priv->sar_irq = LNXINTNUM (ATM_SAR_INT);      /* Interrupt line # */
--  if (request_irq (priv->sar_irq, tn7atm_sar_irq, SA_INTERRUPT, "SAR ", dev))
-+  if (request_irq (priv->sar_irq, tn7atm_sar_irq, IRQF_DISABLED, "SAR ", dev))
-     printk ("Could not register tn7atm_sar_irq\n");
- 
-   /*
-    * interrupt pacing
-    */
-   ptr = prom_getenv ("sar_ipacemax");
--  if (ptr)
-+  if (ptr || mp_sar_ipacemax != -1)
-   {
--    def_sar_inter_pace = os_atoi (ptr);
-+    def_sar_inter_pace = mp_sar_ipacemax == -1 ? os_atoi (ptr) : mp_sar_ipacemax;
-   }
--  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
--                            def_sar_inter_pace);
-+/*  avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
-+                            def_sar_inter_pace);*/
- 
-   /*
-    * Reigster Receive interrupt A
-    */
-   priv->dsl_irq = LNXINTNUM (ATM_DSL_INT);      /* Interrupt line # */
--  if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, SA_INTERRUPT, "DSL ", dev))
-+  if (request_irq (priv->dsl_irq, tn7atm_dsl_irq, IRQF_DISABLED, "DSL ", dev))
-     printk ("Could not register tn7atm_dsl_irq\n");
- 
- /***** VRB Tasklet Mode ****/
-@@ -842,7 +943,7 @@ static int __init tn7atm_get_ESI (struct
-   char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
-   char *esiaddr_str = NULL;
- 
--  esiaddr_str = prom_getenv ("maca");
-+  esiaddr_str = mp_macc ? mp_macc : prom_getenv ("maca");
- 
-   if (!esiaddr_str)
-   {
-@@ -875,11 +976,15 @@ static int __init tn7atm_get_ESI (struct
- #define ATM_VBR_RT     5
- #endif
- 
--int tn7atm_open (struct atm_vcc *vcc, short vpi, int vci)
-+int tn7atm_open (struct atm_vcc *vcc)
- {
-   tn7atm_activate_vc_parm_t tn7atm_activate_vc_parm;
-   int rc;
-   //int flags;
-+  tn7atm_activate_vc_parm.pcr = 0x20000;
-+  tn7atm_activate_vc_parm.scr = 0x20000;
-+  tn7atm_activate_vc_parm.mbs = 0x20000;
-+  tn7atm_activate_vc_parm.cdvt = 10000;
- 
-   dgprintf(1, "tn7atm_open()\n");
- 
-@@ -891,24 +996,18 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-     return -1;
-   }
- 
--  MOD_INC_USE_COUNT;
--
--  /* find a free VPI/VCI */
--  tn7atm_walk_vccs(vcc, &vpi, &vci);
--
--  vcc->vpi = vpi;
--  vcc->vci = vci;
-+//  MOD_INC_USE_COUNT;
- 
--  if ((vci == ATM_VCI_UNSPEC) || (vpi == ATM_VCI_UNSPEC))
-+  if ((vcc->vci == ATM_VCI_UNSPEC) || (vcc->vpi == ATM_VCI_UNSPEC))
-   {
--    MOD_DEC_USE_COUNT;
-+//    MOD_DEC_USE_COUNT;
-     return -EBUSY;
-   }
- 
--  tn7atm_activate_vc_parm.vpi = vpi;
--  tn7atm_activate_vc_parm.vci = vci;
-+  tn7atm_activate_vc_parm.vpi = vcc->vpi;
-+  tn7atm_activate_vc_parm.vci = vcc->vci;
- 
--  if ((vpi == CLEAR_EOC_VPI) && (vci == CLEAR_EOC_VCI))
-+  if ((vcc->vpi == CLEAR_EOC_VPI) && (vcc->vci == CLEAR_EOC_VCI))
-   {
-     /* always use (max_dma_chan+1) for clear eoc */
-     tn7atm_activate_vc_parm.chan = EOC_DMA_CHAN;
-@@ -916,7 +1015,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-     /* check to see whether clear eoc is opened or not */
-     if (tn7atm_activate_vc_parm.priv->lut[tn7atm_activate_vc_parm.chan].inuse)
-     {
--      MOD_DEC_USE_COUNT;
-+//      MOD_DEC_USE_COUNT;
-       printk("tn7atm_open: Clear EOC channel (dmachan=%d) already in use.\n", tn7atm_activate_vc_parm.chan);
-       return -EBUSY;
-     }
-@@ -925,7 +1024,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-     if (rc)
-     {
-       printk("tn7atm_open: failed to setup clear_eoc\n");
--      MOD_DEC_USE_COUNT;
-+//      MOD_DEC_USE_COUNT;
-       return -EBUSY;
-     }
-     tn7atm_set_lut(tn7atm_activate_vc_parm.priv,vcc, tn7atm_activate_vc_parm.chan);
-@@ -934,17 +1033,17 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-   }
-   else  /* PVC channel setup */
-   {
--    if ((vpi==REMOTE_MGMT_VPI) && (vci==REMOTE_MGMT_VCI))
-+    if ((vcc->vpi==REMOTE_MGMT_VPI) && (vcc->vci==REMOTE_MGMT_VCI))
-     {
-       tn7atm_activate_vc_parm.chan = 14;   /* always use chan 14 for MII PVC-base romote mgmt */
-     }
-     else
-     {
--       rc = tn7atm_lut_find(vpi, vci);
-+       rc = tn7atm_lut_find(vcc->vpi, vcc->vci);
-       /* check to see whether PVC is opened or not */
-       if(ATM_NO_DMA_CHAN != rc)
-       {
--        MOD_DEC_USE_COUNT;
-+//        MOD_DEC_USE_COUNT;
-         printk("PVC already opened. dmachan = %d\n", rc);
-         return -EBUSY;
-       }
-@@ -976,6 +1075,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-        tn7atm_activate_vc_parm.priority = 2;
-        break;
- 
-+#if 0
-      case ATM_VBR: /* Variable Bit Rate-Non RealTime*/
-        tn7atm_activate_vc_parm.qos = 1;
-        tn7atm_activate_vc_parm.priority = 1;
-@@ -997,6 +1097,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-            tn7atm_activate_vc_parm.mbs = vcc->qos.txtp.max_pcr;
-        tn7atm_activate_vc_parm.cdvt = vcc->qos.txtp.max_cdv;
-        break;
-+#endif
- 
-      default:
-          tn7atm_activate_vc_parm.qos = 2;
-@@ -1024,7 +1125,7 @@ int tn7atm_open (struct atm_vcc *vcc, sh
-    if (rc < 0)
-    {
-       printk("failed to activate hw channel\n");
--      MOD_DEC_USE_COUNT;
-+//      MOD_DEC_USE_COUNT;
-       tn7atm_lut_clear(vcc, tn7atm_activate_vc_parm.chan);
-       //spin_unlock_irqrestore(&chan_init_lock, flags);
-       return -EBUSY;
-@@ -1114,7 +1215,7 @@ void tn7atm_close (struct atm_vcc *vcc)
-   tn7atm_lut_clear (vcc, dmachan);
-   //spin_unlock_irqrestore (&closeLock, closeFlag);
- 
--  MOD_DEC_USE_COUNT;
-+//  MOD_DEC_USE_COUNT;
- 
-   dgprintf (1, "Leave tn7atm_close\n");
- }
-@@ -1528,8 +1629,7 @@ int tn7atm_receive (void *os_dev, int ch
-                                  * firewall is on */
- 
-   dgprintf (3, "pushing the skb...\n");
--
--  skb->stamp = vcc->timestamp = xtime;
-+  __net_timestamp(skb);
- 
-   xdump ((unsigned char *) skb->data, skb->len, 5);
- 
-@@ -1725,8 +1825,7 @@ static void tn7atm_exit (void)
- 
-   kfree (dev->dev_data);
- 
--  // atm_dev_deregister (dev);
--  shutdown_atm_dev (dev);
-+  atm_dev_deregister (dev);
- 
-   /*
-    * remove proc entries
-@@ -1885,9 +1984,6 @@ static int __init tn7atm_detect (void)
-   /*
-    * Set up proc entry for atm stats
-    */
--  if (tn7atm_xlate_proc_name
--      (drv_proc_root_folder, &root_proc_dir_entry, &residual))
--  {
-     printk ("Creating new root folder %s in the proc for the driver stats \n",
-             drv_proc_root_folder);
-     root_proc_dir_entry = proc_mkdir (drv_proc_root_folder, NULL);
-@@ -1897,7 +1993,6 @@ static int __init tn7atm_detect (void)
-       return -ENOMEM;
-     }
-     proc_root_already_exists = FALSE;
--  }
- 
-   /*
-    * AV: Clean-up. Moved all the definitions to the data structure.
-@@ -1981,15 +2076,15 @@ static int tn7atm_autoDetectDspBoost (vo
- //UR8_MERGE_END   CQ10450*
- 
-   cp = prom_getenv ("dsp_noboost");
--  if (cp)
-+  if (cp || mp_dsp_noboost != -1)
-   {
--    dsp_noboost = os_atoi (cp);
-+    dsp_noboost = mp_dsp_noboost == -1 ? os_atoi (cp) : mp_dsp_noboost;
-   }
- 
-   cp = (char *) prom_getenv ("dsp_freq");
--  if (cp)
-+  if (cp || mp_dsp_freq != -1)
-   {
--    dspfreq = os_atoi (cp);
-+    dspfreq = mp_dsp_freq == -1 ? os_atoi (cp) : mp_dsp_freq;
-     if (dspfreq == 250)
-     {
-       boostDsp = 1;
-@@ -2238,8 +2333,9 @@ static int __init tn7atm_init (struct at
-   // Inter-Op DSL phy Control
-   // Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
-   // dslhal_api_dslStartup (in tn7dsl_init()).
--  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL)
-+  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_0")) != NULL || mp_featctl0 != NULL)
-   {
-+    if (mp_featctl0 != NULL) ptr = mp_featctl0;
-     if ((ptr[0] == '0') && (ptr[1] == 'x'))     // skip 0x before pass to
-       // os_atoh
-       ptr += 2;
-@@ -2247,8 +2343,9 @@ static int __init tn7atm_init (struct at
-     _dsl_Feature_0_defined = 1;
-   }
- 
--  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL)
-+  if ((ptr = prom_getenv ("DSL_FEATURE_CNTL_1")) != NULL || mp_featctl1 != NULL)
-   {
-+    if (mp_featctl1 != NULL) ptr = mp_featctl1;
-     if ((ptr[0] == '0') && (ptr[1] == 'x'))     // skip 0x before pass to
-       // os_atoh
-       ptr += 2;
-@@ -2260,8 +2357,9 @@ static int __init tn7atm_init (struct at
-   // DSL phy Feature Control
-   // Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
-   // dslhal_api_dslStartup (in tn7dsl_init()).
--  if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL)
-+  if ((ptr = prom_getenv ("DSL_PHY_CNTL_0")) != NULL || mp_phyctl0 != NULL)
-   {
-+    if (mp_phyctl0 != NULL) ptr = mp_phyctl0;
-     if ((ptr[0] == '0') && (ptr[1] == 'x'))     // skip 0x before pass to
-       // os_atoh
-       ptr += 2;
-@@ -2269,8 +2367,9 @@ static int __init tn7atm_init (struct at
-     _dsl_PhyControl_0_defined = 1;
-   }
- 
--  if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL)
-+  if ((ptr = prom_getenv ("DSL_PHY_CNTL_1")) != NULL || mp_phyctl1 != NULL)
-   {
-+    if (mp_phyctl1 != NULL) ptr = mp_phyctl1;
-     if ((ptr[0] == '0') && (ptr[1] == 'x'))     // skip 0x before pass to
-       // os_atoh
-       ptr += 2;
-@@ -2298,9 +2397,9 @@ static int __init tn7atm_init (struct at
-   priv->bTurboDsl = 1;
-   // read config for turbo dsl
-   ptr = prom_getenv ("TurboDSL");
--  if (ptr)
-+  if (ptr || mp_turbodsl != -1)
-   {
--    priv->bTurboDsl = os_atoi (ptr);
-+    priv->bTurboDsl = mp_turbodsl == -1 ? os_atoi (ptr) : mp_turbodsl;
-   }
- 
-   // @Added to make Rx buffer number & Service max configurable through
-@@ -2308,30 +2407,30 @@ static int __init tn7atm_init (struct at
-   priv->sarRxBuf = RX_BUFFER_NUM;
-   ptr = NULL;
-   ptr = prom_getenv ("SarRxBuf");
--  if (ptr)
-+  if (ptr || mp_sar_rxbuf != -1)
-   {
--    priv->sarRxBuf = os_atoi (ptr);
-+    priv->sarRxBuf = mp_sar_rxbuf == -1 ? os_atoi (ptr) : mp_sar_rxbuf;
-   }
-   priv->sarRxMax = RX_SERVICE_MAX;
-   ptr = NULL;
-   ptr = prom_getenv ("SarRxMax");
--  if (ptr)
-+  if (ptr || mp_sar_rxmax != -1)
-   {
--    priv->sarRxMax = os_atoi (ptr);
-+    priv->sarRxMax = mp_sar_rxmax == -1 ? os_atoi (ptr) : mp_sar_rxmax;
-   }
-   priv->sarTxBuf = TX_BUFFER_NUM;
-   ptr = NULL;
-   ptr = prom_getenv ("SarTxBuf");
--  if (ptr)
-+  if (ptr || mp_sar_txbuf != -1)
-   {
--    priv->sarTxBuf = os_atoi (ptr);
-+    priv->sarTxBuf = mp_sar_txbuf == -1 ? os_atoi (ptr) : mp_sar_txbuf;
-   }
-   priv->sarTxMax = TX_SERVICE_MAX;
-   ptr = NULL;
-   ptr = prom_getenv ("SarTxMax");
--  if (ptr)
-+  if (ptr || mp_sar_txmax != -1)
-   {
--    priv->sarTxMax = os_atoi (ptr);
-+    priv->sarTxMax = mp_sar_txmax == -1 ? os_atoi (ptr) : mp_sar_txmax;
-   }
- 
-   return 0;
-@@ -2479,7 +2578,5 @@ static int tn7atm_proc_qos_write(struct 
-     return count;
- }
- 
--#ifdef MODULE
- module_init (tn7atm_detect);
- module_exit (tn7atm_exit);
--#endif /* MODULE */

+ 0 - 56
package/sangam-atm/patches/patch-tn7atm_h

@@ -1,56 +0,0 @@
---- sangam-atm-1.0.orig/tn7atm.h	2006-04-05 07:33:06.000000000 +0200
-+++ sangam-atm-1.0/tn7atm.h	2009-12-17 23:42:04.069784991 +0100
-@@ -19,7 +19,8 @@
- //#include  "mips_support.h"
- #include  <linux/list.h>
- 
--#include <linux/config.h>
-+#define MIPS_EXCEPTION_OFFSET 8
-+#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
- 
- #ifdef CONFIG_MODVERSIONS
- #include <linux/modversions.h>
-@@ -61,37 +62,6 @@ extern int avalanche_request_pacing(int 
- #include <linux/release.h>
- #endif /* CONFIG_HAS_RELEASE_H_FILE */
- 
--/* Base PSP 7.4 support */
--#if ((PSP_VERSION_MAJOR == 7) && (PSP_VERSION_MINOR == 4))
--#define TIATM_INST_SUPP     /* Enable Instrumentation code. */
--#define __NO__VOICE_PATCH__ /* Not required anymore. */
--
--#if defined (CONFIG_MIPS_AVALANCHE_COLORED_LED)
--#include <asm/avalanche/generic/led_manager.h>
--
--/* LED handles */
--extern void *hnd_LED_0; 
--
--#define MOD_ADSL          1
--#define DEF_ADSL_IDLE     1
--#define DEF_ADSL_TRAINING 2
--#define DEF_ADSL_SYNC     3
--#define DEF_ADSL_ACTIVITY 4
--
--#define LED_NUM_1 0
--#define LED_NUM_2 1
--
--#endif /*defined (CONFIG_MIPS_AVALANCHE_COLORED_LED)*/
--
--/* So as to not cause any confusion. */
--#ifdef BASE_PSP_7X
--#undef BASE_PSP_7X
--#endif /*BASE_PSP_7X*/
--
--#define TN7DSL_LED_ACTION(module_handle, module_name, state_id) led_manager_led_action(module_handle, state_id)
--
--#endif /*((PSP_VERSION_MAJOR == 7) && (PSP_VERSION_MINOR == 4)) */
--
- #ifdef CONFIG_LED_MODULE
- #ifndef BASE_PSP_7X
- #include <asm/avalanche/ledapp.h>
-@@ -275,4 +245,4 @@ typedef struct
- #define PHYS_TO_K1(X)                             (PHYS_ADDR(X)|K1BASE)
- #endif
- 
--#endif __TN7ATM_H
-+#endif

+ 0 - 726
package/sangam-atm/patches/patch-tn7dsl_c

@@ -1,726 +0,0 @@
---- sangam-atm-1.0.orig/tn7dsl.c	2007-01-04 09:04:14.000000000 +0100
-+++ sangam-atm-1.0/tn7dsl.c	2010-03-06 12:40:16.000000000 +0100
-@@ -94,7 +94,6 @@
- *  1/02/07  JZ     CQ11054: Data Precision and Range Changes for TR-069 Conformance
- *  UR8_MERGE_END   CQ11054*
-  *********************************************************************************************/
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -102,8 +101,6 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-@@ -111,6 +108,18 @@
- #include <linux/timer.h>
- #include <linux/vmalloc.h>
- #include <linux/file.h>
-+#include <linux/firmware.h>
-+#include <linux/version.h>
-+
-+#include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
-+
- /* Modules specific header files */
- #include "tn7atm.h"
- #include "tn7api.h"
-@@ -133,6 +142,27 @@
- #define NEW_TRAINING_VAL_T1413  128
- #define NEW_TRAINING_VAL_MMODE  255
- 
-+extern char *mp_modulation;
-+extern int mp_fine_gain_control;
-+extern int mp_fine_gain_value;
-+extern int mp_enable_margin_retrain;
-+extern int mp_margin_threshold;
-+extern int mp_enable_rate_adapt;
-+extern int mp_powercutback;
-+extern int mp_trellis;
-+extern int mp_bitswap;
-+extern int mp_maximum_bits_per_carrier;
-+extern int mp_maximum_interleave_depth;
-+extern int mp_pair_selection;
-+extern int mp_dgas_polarity;
-+extern int mp_los_alarm;
-+extern char *mp_eoc_vendor_id;
-+extern int mp_eoc_vendor_revision;
-+extern char *mp_eoc_vendor_serialnum;
-+extern char *mp_invntry_vernum;
-+extern int mp_dsl_bit_tmode;
-+extern int mp_high_precision;
-+
- int testflag1 = 0;
- extern int  __guDbgLevel;
- extern sar_stat_t sarStat;
-@@ -173,7 +203,6 @@ led_reg_t ledreg[2];
- static struct led_funcs ledreg[2];
- #endif
- 
--#define DEV_DSLMOD       1
- #define MAX_STR_SIZE     256
- #define DSL_MOD_SIZE     256
- 
-@@ -299,7 +328,7 @@ static PITIDSLHW_T    pIhw;
- static volatile int bshutdown;
- static char info[MAX_STR_SIZE];
- /* Used for DSL Polling enable */
--static DECLARE_MUTEX_LOCKED (adsl_sem_overlay);
-+static struct semaphore adsl_sem_overlay;
- 
- //kthread_t overlay_thread;
- /* end of module wide declars */
-@@ -309,8 +338,7 @@ static void tn7dsl_chng_modulation(void*
- static unsigned int tn7dsl_set_modulation(void* data, int flag);
- static void tn7dsl_ctrl_fineGain(int value);
- static void tn7dsl_set_fineGainValue(int value);
--static int dslmod_sysctl (ctl_table * ctl, int write, struct file *filp,
--                          void *buffer, size_t * lenp);
-+static int dslmod_sysctl (ctl_table * ctl, int write, void *buffer, size_t * lenp, loff_t *ppos);
- static void tn7dsl_register_dslss_led(void);
- void tn7dsl_dslmod_sysctl_register(void);
- void tn7dsl_dslmod_sysctl_unregister(void);
-@@ -323,6 +351,14 @@ static int tn7dsl_proc_snr_print (char *
- #define gDot1(a) ((a>0)?(a%10):((-a)%10))
- //  UR8_MERGE_END   CQ11054*
- 
-+int avalanche_request_intr_pacing(int irq_nr, unsigned int blk_num,
-+                            unsigned int pace_value)
-+{
-+	printk("avalanche_request_pacing(%d, %u, %u); // not implemented\n", irq_nr, blk_num, pace_value);
-+	return 0;
-+}
-+
-+
- int os_atoi(const char *pStr)
- {
-   int MulNeg = (*pStr == '-' ? -1 : 1);
-@@ -359,39 +395,6 @@ void dprintf (int uDbgLevel, char *szFmt
- #endif
- }
- 
--int strcmp(const char *s1, const char *s2)
--{
--
--  int size = strlen(s1);
--
--  return(strncmp(s1, s2, size));
--}
--
--int strncmp(const char *s1, const char *s2, size_t size)
--{
--  int i = 0;
--  int max_size = (int)size;
--
--  while((s1[i] != 0) && i < max_size)
--  {
--    if(s2[i] == 0)
--    {
--      return -1;
--    }
--    if(s1[i] != s2[i])
--    {
--       return 1;
--    }
--    i++;
--  }
--  if(s2[i] != 0)
--  {
--    return 1;
--  }
--
--  return 0;
--}
--
- // * UR8_MERGE_START CQ10640   Jack Zhang
- int tn7dsl_dump_dsp_memory(char *input_str) //cph99
-   {
-@@ -441,101 +444,79 @@ unsigned int shim_osGetCpuFrequency(void
-   return CpuFrequency;
- }
- 
--int shim_osLoadFWImage(unsigned char *ptr)
-+static void avsar_release(struct device *dev)
- {
--  unsigned int bytesRead;
--  mm_segment_t  oldfs;
--  static struct file *filp;
--  unsigned int imageLength=0x5ffff;
--
--
--  dgprintf(4, "tn7dsl_read_dsp()\n");
--
--  dgprintf(4,"open file %s\n", DSP_FIRMWARE_PATH);
--
--  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
--  if(filp ==NULL)
--  {
--    printk("Failed: Could not open DSP binary file\n");
--          return -1;
--  }
--
--  if (filp->f_dentry != NULL)
--  {
--    if (filp->f_dentry->d_inode != NULL)
--    {
--      printk ("DSP binary filesize = %d bytes\n",
--              (int) filp->f_dentry->d_inode->i_size);
--      imageLength = (unsigned int)filp->f_dentry->d_inode->i_size + 0x200;
--    }
--  }
--
--  if (filp->f_op->read==NULL)
--          return -1;  /* File(system) doesn't allow reads */
--
--  /*
--   * Disable parameter checking
--   */
--  oldfs = get_fs();
--  set_fs(KERNEL_DS);
--
--  /*
--   * Now read bytes from postion "StartPos"
--   */
--  filp->f_pos = 0;
--
--  bytesRead = filp->f_op->read(filp,ptr,imageLength,&filp->f_pos);
--
--  dgprintf(4,"file length = %d\n", bytesRead);
--
--  set_fs(oldfs);
--
--  /*
--   * Close the file
--   */
--  fput(filp);
--
--  return bytesRead;
-+	printk(KERN_DEBUG "avsar firmware released\n");
- }
- 
-+static struct device avsar = {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
-+	.bus_id    = "vlynq",
-+#endif
-+	.release   = avsar_release,
-+};
- 
--unsigned int shim_read_overlay_page (void *ptr, unsigned int secOffset,
--                                     unsigned int secLength)
-+int shim_osLoadFWImage(unsigned char *ptr)
- {
--  unsigned int bytesRead;
--  mm_segment_t  oldfs;
--  struct file *filp;
--
--  dgprintf(4,"shim_read_overlay_page\n");
--  //dgprintf(4,"sec offset=%d, sec length =%d\n", secOffset, secLength);
-+	const struct firmware *fw_entry;
-+	size_t size;
- 
--  filp=filp_open(DSP_FIRMWARE_PATH,00,O_RDONLY);
--  if(filp ==NULL)
--  {
--    printk("Failed: Could not open DSP binary file\n");
--          return -1;
--  }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
-+	dev_set_name(&avsar, "avsar");
-+#endif
-+	printk("requesting firmware image \"ar0700xx.bin\"\n");
-+	if(device_register(&avsar) < 0) {
-+		printk(KERN_ERR
-+			"avsar: device_register fails\n");
-+		return -1;
-+	}
- 
--  if (filp->f_op->read==NULL)
--          return -1;  /* File(system) doesn't allow reads */
-+	if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
-+		printk(KERN_ERR
-+			"avsar: Firmware not available\n");
-+		device_unregister(&avsar);
-+		return -1;
-+	}
-+	size = fw_entry->size;
-+	device_unregister(&avsar);
-+	if(size > 0x5ffff) {
-+			printk(KERN_ERR
-+			"avsar: Firmware too big (%d bytes)\n", size);
-+			release_firmware(fw_entry);
-+			return -1;
-+		}
-+	memcpy(ptr, fw_entry->data, size);
-+	release_firmware(fw_entry);
-+	return size;
-+}
- 
--  /*
--   * Now read bytes from postion "StartPos"
--   */
-+unsigned int shim_read_overlay_page(void *ptr, unsigned int secOffset, unsigned int secLength)
-+{
-+	const struct firmware *fw_entry;
- 
--  if(filp->f_op->llseek)
--    filp->f_op->llseek(filp,secOffset, 0);
--  oldfs = get_fs();
--  set_fs(KERNEL_DS);
--  filp->f_pos = secOffset;
--  bytesRead = filp->f_op->read(filp,ptr,secLength,&filp->f_pos);
-+	printk("requesting firmware image \"ar0700xx.bin\"\n");
-+	if(device_register(&avsar) < 0) {
-+		printk(KERN_ERR
-+			"avsar: device_register fails\n");
-+		return -1;
-+	}
- 
--  set_fs(oldfs);
--  /*
--   * Close the file
--   */
--  fput(filp);
--  return bytesRead;
-+	if(request_firmware(&fw_entry, "ar0700xx.bin", &avsar)) {
-+		printk(KERN_ERR
-+			"avsar: Firmware not available\n");
-+		device_unregister(&avsar);
-+		return -1;
-+	}
-+	device_unregister(&avsar);
-+	if(fw_entry->size > secLength) {
-+		printk(KERN_ERR
-+			"avsar: Firmware too big (%d bytes)\n", fw_entry->size);
-+		release_firmware(fw_entry);
-+		return -1;
-+	}
-+	memcpy(ptr + secOffset, fw_entry->data, secLength);
-+	release_firmware(fw_entry);
-+	return secLength;
- }
- 
- int shim_osLoadDebugFWImage(unsigned char *ptr)
-@@ -2834,7 +2815,6 @@ static int tn7dsl_set_dsl(void)
-   int value;
-   int i, offset[2]={4,11},oamFeature=0;
-   char tmp[4];
--  char dspVer[10];
- 
-   // OAM Feature Configuration
-   dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
-@@ -2845,98 +2825,82 @@ static int tn7dsl_set_dsl(void)
-                                 (unsigned int *) &offset,
-                                 (unsigned char *) &oamFeature, 4);
- 
--  /* Do only if we are in the new Base PSP 7.4.*/
--  #if ((PSP_VERSION_MAJOR == 7) && (PSP_VERSION_MINOR == 4))
--  /* Check to see if we are operating in the new bit mode. */
--  ptr = prom_getenv("DSL_BIT_TMODE");
--  if (ptr)
--  {
--    /* If we are see if this is the first time the user has upgraded. */
--    ptr = prom_getenv("DSL_UPG_DONE");
--    if(!ptr)
--      {
--         /* If it is the first time the user is upgrading, then make sure that
--             we clear the modulation environment variable, as this could potentially
--             not have the same meaning in the new mode.
--          */
--         prom_unsetenv("modulation");
--         prom_setenv("DSL_UPG_DONE", "1");
--      }
--  }
--  #endif
--
-   // modulation
-   ptr = prom_getenv("modulation");
--  if (ptr)
-+  if (ptr || mp_modulation != NULL)
-   {
--    tn7dsl_set_modulation(ptr, FALSE);
-+    tn7dsl_set_modulation(mp_modulation == NULL ? ptr : mp_modulation, FALSE);
-   }
- 
-   // Fine Gains
-   ptr = prom_getenv("fine_gain_control");
--  if (ptr)
-+  if (ptr || mp_fine_gain_control != -1)
-   {
--    value = os_atoi(ptr);
-+    value = mp_fine_gain_control == -1 ? os_atoi(ptr) : mp_fine_gain_control;
-     tn7dsl_ctrl_fineGain(value);
-   }
-   ptr = NULL;
-   ptr = prom_getenv("fine_gain_value");
--  if(ptr)
--    tn7dsl_set_fineGainValue(os_atoh(ptr));
-+  if(ptr || mp_fine_gain_value != -1)
-+    tn7dsl_set_fineGainValue(mp_fine_gain_value == -1 ? os_atoh(ptr) : mp_fine_gain_value);
- 
-   // margin retrain
-   ptr = NULL;
-   ptr = prom_getenv("enable_margin_retrain");
--  if(ptr)
-+  value = mp_enable_margin_retrain == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_enable_margin_retrain;
-+
-+  if (value == 1)
-   {
--    value = os_atoi(ptr);
--    if(value == 1)
-+    dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
-+    bMarginRetrainEnable = 1;
-+    //printk("enable showtime margin monitor.\n");
-+
-+    ptr = NULL;
-+    ptr = prom_getenv("margin_threshold");
-+    value = mp_margin_threshold == -1 ? (ptr ? os_atoi(ptr) : 0) : mp_margin_threshold;
-+
-+    if(value >= 0)
-     {
--      dslhal_api_setMarginMonitorFlags(pIhw, 0, 1);
--      bMarginRetrainEnable = 1;
--      //printk("enable showtime margin monitor.\n");
--      ptr = NULL;
--      ptr = prom_getenv("margin_threshold");
--      if(ptr)
--      {
--        value = os_atoi(ptr);
--        //printk("Set margin threshold to %d x 0.5 db\n",value);
--        if(value >= 0)
--        {
--          dslhal_api_setMarginThreshold(pIhw, value);
--          bMarginThConfig=1;
--        }
--      }
-+      dslhal_api_setMarginThreshold(pIhw, value);
-+      bMarginThConfig=1;
-     }
-   }
- 
-   // rate adapt
-   ptr = NULL;
-   ptr = prom_getenv("enable_rate_adapt");
--  if(ptr)
-+  if(ptr || mp_enable_rate_adapt != -1)
-   {
--    dslhal_api_setRateAdaptFlag(pIhw, os_atoi(ptr));
-+    dslhal_api_setRateAdaptFlag(pIhw, mp_enable_rate_adapt == -1 ? os_atoi(ptr) : mp_enable_rate_adapt);
-+  }
-+
-+  // set powercutback
-+  ptr = NULL;
-+  ptr = prom_getenv("powercutback");
-+  if(ptr || mp_powercutback != -1)
-+  {
-+    dslhal_advcfg_onOffPcb(pIhw, mp_powercutback == -1 ? os_atoi(ptr) : mp_powercutback);
-   }
- 
-   // trellis
-   ptr = NULL;
-   ptr = prom_getenv("trellis");
--  if(ptr)
-+  if(ptr || mp_trellis != -1)
-   {
--    dslhal_api_setTrellisFlag(pIhw, os_atoi(ptr));
--    trellis = os_atoi(ptr);
-+    trellis = mp_trellis == -1 ? os_atoi(ptr) : mp_trellis;
-+    dslhal_api_setTrellisFlag(pIhw, trellis);
-     //printk("trellis=%d\n");
-   }
- 
-   // bitswap
-   ptr = NULL;
-   ptr = prom_getenv("bitswap");
--  if(ptr)
-+  if(ptr || mp_bitswap != -1)
-   {
-     int offset[2] = {33, 0};
-     unsigned int bitswap;
- 
--    bitswap = os_atoi(ptr);
-+    bitswap = mp_bitswap == -1 ? os_atoi(ptr) : mp_bitswap;
- 
-     tn7dsl_generic_read(2, offset);
-     dslReg &= dslhal_support_byteSwap32(0xFFFFFF00);
-@@ -2954,46 +2918,47 @@ static int tn7dsl_set_dsl(void)
-   // maximum bits per carrier
-   ptr = NULL;
-   ptr = prom_getenv("maximum_bits_per_carrier");
--  if(ptr)
-+  if(ptr || mp_maximum_bits_per_carrier != -1)
-   {
--    dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, os_atoi(ptr));
-+    dslhal_api_setMaxBitsPerCarrierUpstream(pIhw, mp_maximum_bits_per_carrier == -1 ? os_atoi(ptr) : mp_maximum_bits_per_carrier);
-   }
- 
-   // maximum interleave depth
-   ptr = NULL;
-   ptr = prom_getenv("maximum_interleave_depth");
--  if(ptr)
-+  if(ptr || mp_maximum_interleave_depth != -1)
-   {
--    dslhal_api_setMaxInterleaverDepth(pIhw, os_atoi(ptr));
-+    dslhal_api_setMaxInterleaverDepth(pIhw, mp_maximum_interleave_depth == -1 ? os_atoi(ptr) : mp_maximum_interleave_depth);
-   }
- 
-   // inner and outer pairs
-   ptr = NULL;
-   ptr = prom_getenv("pair_selection");
--  if(ptr)
-+  if(ptr || mp_pair_selection != -1)
-   {
--    dslhal_api_selectInnerOuterPair(pIhw, os_atoi(ptr));
-+    dslhal_api_selectInnerOuterPair(pIhw, mp_pair_selection == -1 ? os_atoi(ptr) : mp_pair_selection);
-   }
- 
-   ptr = NULL;
-   ptr = prom_getenv("dgas_polarity");
--  if(ptr)
-+  if(ptr || mp_dgas_polarity != -1)
-   {
-     dslhal_api_configureDgaspLpr(pIhw, 1, 1);
--    dslhal_api_configureDgaspLpr(pIhw, 0, os_atoi(ptr));
-+    dslhal_api_configureDgaspLpr(pIhw, 0, mp_dgas_polarity == -1 ? os_atoi(ptr) : mp_dgas_polarity);
-   }
- 
-   ptr = NULL;
-   ptr = prom_getenv("los_alarm");
--  if(ptr)
-+  if(ptr || mp_los_alarm != -1)
-   {
--    dslhal_api_disableLosAlarm(pIhw, os_atoi(ptr));
-+    dslhal_api_disableLosAlarm(pIhw, mp_los_alarm == -1 ? os_atoi(ptr) : mp_los_alarm);
-   }
- 
-   ptr = NULL;
-   ptr = prom_getenv("eoc_vendor_id");
--  if(ptr)
-+  if(ptr || mp_eoc_vendor_id != NULL)
-   {
-+    ptr = mp_eoc_vendor_id == NULL ? ptr : mp_eoc_vendor_id;
-     for(i=0;i<8;i++)
-     {
-       tmp[0]=ptr[i*2];
-@@ -3018,26 +2983,26 @@ static int tn7dsl_set_dsl(void)
-   }
-   ptr = NULL;
-   ptr = prom_getenv("eoc_vendor_revision");
--  if(ptr)
-+  if(ptr || mp_eoc_vendor_revision != -1)
-   {
--    value = os_atoi(ptr);
-+    value = mp_eoc_vendor_revision == -1 ? os_atoi(ptr) : mp_eoc_vendor_revision;
-     //printk("eoc rev=%d\n", os_atoi(ptr));
-     dslhal_api_setEocRevisionNumber(pIhw, (char *)&value);
- 
-   }
-   ptr = NULL;
-   ptr = prom_getenv("eoc_vendor_serialnum");
--  if(ptr)
-+  if(ptr || mp_eoc_vendor_serialnum != NULL)
-   {
--    dslhal_api_setEocSerialNumber(pIhw, ptr);
-+    dslhal_api_setEocSerialNumber(pIhw, mp_eoc_vendor_serialnum == NULL ? ptr : mp_eoc_vendor_serialnum);
-   }  
-   
-   // CQ10037 Added invntry_vernum environment variable to be able to set version number in ADSL2, ADSL2+ modes.  
-   ptr = NULL;
-   ptr = prom_getenv("invntry_vernum");
--  if(ptr)
-+  if(ptr || mp_invntry_vernum != NULL)
-   {
--    dslhal_api_setEocRevisionNumber(pIhw, ptr);
-+    dslhal_api_setEocRevisionNumber(pIhw, mp_invntry_vernum == NULL ? ptr : mp_invntry_vernum);
-   }
- 
-   return 0;
-@@ -3064,6 +3029,7 @@ int tn7dsl_init(void *priv)
-   int high_precision_selected = 0;  
- //  UR8_MERGE_END   CQ11054*
- 
-+  sema_init(&adsl_sem_overlay, 0);
-   /*
-    * start dsl
-    */
-@@ -3081,7 +3047,7 @@ int tn7dsl_init(void *priv)
-    * backward compatibility.
-    */
-   cp = prom_getenv("DSL_BIT_TMODE");
--  if (cp)
-+  if (cp || mp_dsl_bit_tmode != -1)
-   {
-     printk("%s : env var DSL_BIT_TMODE is set\n", __FUNCTION__);
-     /*
-@@ -3110,9 +3076,9 @@ int tn7dsl_init(void *priv)
- 
- //  UR8_MERGE_START CQ11054   Jack Zhang
-   cp = prom_getenv("high_precision");
--  if (cp)
-+  if (cp || mp_high_precision != -1)
-   {
--    high_precision_selected = os_atoi(cp);
-+    high_precision_selected = mp_high_precision == -1 ? os_atoi(cp) : mp_high_precision;
-   }
-   if ( high_precision_selected)
-   {
-@@ -3419,8 +3385,7 @@ unsigned int tn7dsl_get_memory(unsigned 
- 
- 
- 
--static int dslmod_sysctl(ctl_table *ctl, int write, struct file * filp,
--      void *buffer, size_t *lenp)
-+static int dslmod_sysctl(ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
- {
-   char *ptr;
-   int ret, len = 0;
-@@ -3432,7 +3397,7 @@ static int dslmod_sysctl(ctl_table *ctl,
-   char mod_req[16] = { '\t' };
-   char fst_byt;
- 
--  if (!*lenp || (filp->f_pos && !write))
-+  if (!*lenp || (!*ppos && !write))
-   {
-     *lenp = 0;
-     return 0;
-@@ -3442,11 +3407,10 @@ static int dslmod_sysctl(ctl_table *ctl,
-    */
-   if(write)
-     {
--    ret = proc_dostring(ctl, write, filp, buffer, lenp);
-+    ret = proc_dostring(ctl, write, buffer, lenp, ppos);
- 
--    switch (ctl->ctl_name)
-+    if (strcmp(ctl->procname, "dslmod") == 0) 
-       {
--      case DEV_DSLMOD:
-       ptr = strpbrk(info, " \t");
-       strcpy(mod_req, info);
- 
-@@ -3456,7 +3420,7 @@ static int dslmod_sysctl(ctl_table *ctl,
-       if (!strcmp (info, "dspfreq"))
-       {
-         printk("dsp_freq = %d\n", SAR_FREQUNCY * 4);
--        break;
-+	return 0;
-       }
-       else if (!strncmp(info,"nohost", 6))
-       {
-@@ -3481,14 +3445,14 @@ static int dslmod_sysctl(ctl_table *ctl,
-             i, curr_setting.phyEnableDisableWord,
-             i, curr_setting.phyControlWord);
-         }
--        break;
-+	return 0;
-       }
- // * UR8_MERGE_START CQ10880   Jack Zhang
-       else if (!strcmp(info,"dsp_l3msg"))
-       {
-         //printk("dsp_l3msg sent to DSP\n");
-         dslhal_api_sendL3Command(pIhw);
--        break;
-+	return 0;
-       }
- // * UR8_MERGE_END   CQ10880*
- 
-@@ -3503,51 +3467,57 @@ static int dslmod_sysctl(ctl_table *ctl,
-                 if( fst_byt == 'S') type = type | (1 << 1);
-                 ret = tn7sar_oam_generation (pIhw->pOsContext, chan, type, vpi, vci, timeout);
-                 break;
--
--       case 'F':
-+      case 'F':
-                 chan = tn7dsl_process_txflush_string (&queue, mod_req);
-                 if (chan < 16)
-                     tn7sar_tx_flush (pIhw->pOsContext, chan, queue, 0);
-                 break;
-       case 'D':
--// * UR8_MERGE_START CQ10640   Jack Zhang
--                if (mod_req[0]=='d') //cph99
-+                if (mod_req[0]=='d')
-                   tn7dsl_dump_dsp_memory (&mod_req[1]);
-                 else 
-                   tn7dsl_dump_memory (&mod_req[1]);
--// * UR8_MERGE_END   CQ10640*
--      break;
-+      		break;
-       case 'W':
-                 tn7dsl_write_memory(&mod_req[1]);
-                 break;
-       default:
-                tn7dsl_chng_modulation (info);
-       }
--      }
-+     }
-     }
-   else
-     {
-     len += sprintf(info+len, mod_req);
--    ret = proc_dostring(ctl, write, filp, buffer, lenp);
-+    ret = proc_dostring(ctl, write, buffer, lenp, ppos);
-     }
-   return ret;
- }
- 
- 
- ctl_table dslmod_table[] = {
--  {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, &dslmod_sysctl}
--  ,
--  {0}
--  };
-+  	{
-+		.procname	= "dslmod", 
-+		.data		= info, 
-+		.maxlen		= DSL_MOD_SIZE, 
-+		.mode		= 0644, 
-+		.proc_handler	= &dslmod_sysctl
-+	},
-+ 	{ }
-+};
- 
- /* Make sure that /proc/sys/dev is there */
- ctl_table dslmod_root_table[] = {
- #ifdef CONFIG_PROC_FS
--  {CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
--  ,
-+  {
-+		.procname	= "dev", 
-+		.maxlen		= 0, 
-+		.mode		= 0555, 
-+		.child		= dslmod_table,
-+  },
- #endif /* CONFIG_PROC_FS */
--  {0}
--  };
-+  { }
-+};
- 
- static struct ctl_table_header *dslmod_sysctl_header;
- 
-@@ -3558,8 +3528,7 @@ void tn7dsl_dslmod_sysctl_register(void)
-   if (initialized == 1)
-     return;
- 
--  dslmod_sysctl_header = register_sysctl_table(dslmod_root_table, 1);
--  dslmod_root_table->child->de->owner = THIS_MODULE;
-+  dslmod_sysctl_header = register_sysctl_table(dslmod_root_table);
- 
-   /*
-    * set the defaults
-@@ -4821,4 +4790,4 @@ int tn7dsl_proc_PMDus(char* buf, char **
- }
- #endif //NO_ADV_STATS
- #endif //TR69_PMD_IN
--// *    UR8_MERGE_END   CQ11057 *
-\ No newline at end of file
-+// *    UR8_MERGE_END   CQ11057 *

+ 0 - 79
package/sangam-atm/patches/patch-tn7sar_c

@@ -1,79 +0,0 @@
---- sangam-atm-1.0.orig/tn7sar.c	2007-05-18 09:46:30.000000000 +0200
-+++ sangam-atm-1.0/tn7sar.c	2009-12-17 19:10:27.628421613 +0100
-@@ -42,7 +42,6 @@
-  * UR8_MERGE_END CQ10700
-  *******************************************************************************/
- 
--#include <linux/config.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
-@@ -50,12 +49,19 @@
- #include <linux/delay.h>
- #include <linux/spinlock.h>
- #include <linux/smp_lock.h>
--#include <asm/io.h>
--#include <asm/mips-boards/prom.h>
- #include <linux/proc_fs.h>
- #include <linux/string.h>
- #include <linux/ctype.h>
-+#include <linux/version.h>
- 
-+#include <asm/io.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+#include <asm/ar7/ar7.h>
-+#include <asm/ar7/prom.h>
-+#else
-+#include <asm/mach-ar7/ar7.h>
-+#include <asm/mach-ar7/prom.h>
-+#endif
- 
- #define _CPHAL_AAL5
- #define _CPHAL_SAR
-@@ -74,6 +80,8 @@ typedef void OS_SETUP;
- /* PDSP Firmware files */
- #include "tnetd7300_sar_firm.h"
- 
-+extern int mp_oam_lb_timeout;
-+extern int mp_autopvc_enable;
- 
- enum
- {
-@@ -103,10 +111,10 @@ enum
- 
- #define RESERVED_OAM_CHANNEL              15
- 
--#define AAL5_PARM "id=aal5, base = 0x03000000, offset = 0, int_line=15, ch0=[RxBufSize=1522; RxNumBuffers = 32; RxServiceMax = 50; TxServiceMax=50; TxNumBuffers=32; CpcsUU=0x5aa5; TxVc_CellRate=0x3000; TxVc_AtmHeader=0x00000640]"
--#define SAR_PARM "id=sar,base = 0x03000000, reset_bit = 9, offset = 0; UniNni = 0, PdspEnable = 1"
-+#define CH0_PARM "RxBufSize=1522, RxNumBuffers=32, RxServiceMax=50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
-+#define AAL5_PARM "id=aal5, base=0x03000000, offset=0, int_line=15, ch0=[" CH0_PARM "]"
-+#define SAR_PARM "id=sar, base=0x03000000, reset_bit=9, offset=0; UniNni=0, PdspEnable=1, Debug=0xFFFFFFFF"
- #define RESET_PARM "id=ResetControl, base=0xA8611600"
--#define CH0_PARM "RxBufSize=1522, RxNumBuffers = 32, RxServiceMax = 50, TxServiceMax=50, TxNumBuffers=32, CpcsUU=0x5aa5, TxVc_CellRate=0x3000, TxVc_AtmHeader=0x00000640"
- 
- #define MAX_PVC_TABLE_ENTRY 16
- 
-@@ -817,9 +825,9 @@ int tn7sar_setup_oam_channel(Tn7AtmPriva
-   pHalDev  = (HAL_DEVICE *)priv->pSarHalDev;
- 
-   pauto_pvc = prom_getenv("autopvc_enable");
--  if(pauto_pvc)  //CQ10273
-+  if(pauto_pvc || mp_autopvc_enable != -1)  //CQ10273
-   {
--    auto_pvc =tn7sar_strtoul(pauto_pvc, NULL, 10);
-+    auto_pvc = mp_autopvc_enable == -1 ? tn7sar_strtoul(pauto_pvc, NULL, 10) : mp_autopvc_enable;
-   }
- 
-   memset(&chInfo, 0xff, sizeof(chInfo));
-@@ -985,9 +993,9 @@ int tn7sar_init(struct atm_dev *dev, Tn7
- 
-   /* read in oam lb timeout value */
-   pLbTimeout = prom_getenv("oam_lb_timeout");
--  if(pLbTimeout)
-+  if(pLbTimeout || mp_oam_lb_timeout != -1)
-   {
--    lbTimeout =tn7sar_strtoul(pLbTimeout, NULL, 10);
-+    lbTimeout = mp_oam_lb_timeout == -1 ? tn7sar_strtoul(pLbTimeout, NULL, 10) : mp_oam_lb_timeout;
-     oamLbTimeout = lbTimeout;
-     pHalFunc->Control(pHalDev,"OamLbTimeout", "Set", &lbTimeout);
-   }

+ 0 - 1
package/section.lst

@@ -13,7 +13,6 @@ debug	Debugging / Analyzing
 dns	DNS / DHCP
 dhcp	DNS / DHCP
 firewall	Firewall / Routing / Bridging
-kernel	External Kernel Modules
 route	Firewall / Routing / Bridging
 bridge	Firewall / Routing / Bridging
 fs	Filesystem / Blockdevice utilities