Archive for Grudzień, 2009

ZTE ZXDSL v2 driver update for Linux Kernel 2.6.31 – 2.6.35 x86

This is patch for ZTE ZXDSL 852 v2 ADSL modem USB Driver
Driver version: USB-ADL-7-2.0-0.2.0.11.

Requirements (Ubuntu)

Package build-essential is required.

Run

# sudo apt-cdrom add

from command line (terminal) if you are offline. This require installation CD-ROM inserted into drive.

Installation

# sudo apt-get install build-essential

Howto

mkdir unicorn
cd unicorn
wget http://linnet.cba.pl/attachment.php?aid=5 -O  zxdsl852.tar.gz
tar zxvf zxdsl852.tar.gz
wget http://mariuszs.googlepages.com/zxdslv2-2.6.31.diff -O zxdslv2-2.6.31.diff
patch src/unicorn_ethdrv.c < zxdslv2-2.6.31.diff
make
sudo make install

Explanation

  • The priv field has been removed from struct net_device; drivers should use netdev_priv() instead.
  • The owner field of struct proc_dir_entry has been removed, causing lots of changes throughout the tree.
  • Most of the callback functions/methods associated with the net_device structure have been moved out of that structure and into the new struct net_device_ops. In-tree drivers have been converted to the new API.

Code

cat zxdslv2-2.6.31.diff

--- ../oryg/src/unicorn_ethdrv.c	2008-10-02 14:10:27.000000000 +0200
+++ src/unicorn_ethdrv.c	2009-11-30 19:20:37.733581549 +0100
@@ -3,6 +3,9 @@
   The chipset consists of the ADSL DMT transceiver ST70138 and the
   ST20174 Analog Front End (AFE).
   This file contains the ethernet interface and SAR routines.
+
+  Updated to work with Linux kernel >= 2.6.31 by
+  Mariusz Smykuła 2009-11-30
 */
 #include
 #include
@@ -961,7 +964,7 @@

 static int unicorn_eth_send(struct sk_buff *skb, struct net_device *eth_dev)
 {
-	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *) eth_dev->priv;
+	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *) netdev_priv(eth_dev);
 	struct atm_ext_skb_data *skb_data;
  	int status;

@@ -1082,7 +1085,7 @@

 static int unicorn_eth_open(struct net_device *eth_dev)
 {
-	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv;
+	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev);

 	DBG(ATM_D,"vpi=%d,vci=%d\n",drv->vpi,drv->vci);

@@ -1100,12 +1103,12 @@
 	// Install the proc_read function in /proc/net/atm/
 #ifndef CONFIG_ATM
 	atm_proc_root = proc_mkdir("net/atm",NULL);
-	if (atm_proc_root) atm_proc_root->owner=THIS_MODULE;
+	//if (atm_proc_root) atm_proc_root->owner=THIS_MODULE;
 #endif
 	if (atm_proc_root) {
 		drv->proc_dir_entry = create_proc_read_entry("UNICORN:0",0,atm_proc_root,unicorn_eth_proc_read,drv);
 		if (drv->proc_dir_entry) {
-			drv->proc_dir_entry->owner = THIS_MODULE;
+			//drv->proc_dir_entry->owner = THIS_MODULE;
 		} else {
 			DBG(ATM_D,"no proc entry installed\n");
 		}
@@ -1126,7 +1129,7 @@
 static int
 unicorn_eth_close(struct net_device *eth_dev)
 {
-	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv;
+	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev);

 	DBG(ATM_D,"\n");

@@ -1153,7 +1156,7 @@

 static struct net_device_stats *unicorn_eth_stats(struct net_device *eth_dev)
 {
-	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv;
+	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev);
 	return &drv->eth_stats;
 }

@@ -1305,7 +1308,7 @@

 static int unicorn_eth_ioctl(struct net_device *eth_dev, struct ifreq *rq, int cmd)
 {
-	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv;
+	struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev);
 	T_MswCtrl ctrl;
 	void *user_buffer;
 	int err = -ENOTTY;
@@ -1376,6 +1379,18 @@
 #endif
 #endif

+
+static const struct net_device_ops unicorn_netdev_ops = {
+       	.ndo_open               = unicorn_eth_open,
+       	.ndo_stop               = unicorn_eth_close,
+	.ndo_do_ioctl		= unicorn_eth_ioctl,
+       	.ndo_change_mtu         = unicorn_eth_change_mtu,
+       	.ndo_start_xmit         = unicorn_eth_send,
+      	.ndo_get_stats 		= unicorn_eth_stats,
+	.ndo_set_multicast_list = unicorn_eth_set_multicast,
+	.ndo_tx_timeout        	= unicorn_eth_tx_timeout
+};
+
 int unicorn_eth_init(void)
 {
 	struct net_device *eth_dev;
@@ -1391,11 +1406,11 @@
 	}

 	eth_dev = alloc_etherdev(sizeof(struct unicorn_ethdrv));
-	if (!eth_dev || !eth_dev->priv) {
+	if (!eth_dev || !netdev_priv(eth_dev)) {
 		DBG(ATM_D,"no memory for drv data\n");
 		return -ENOMEM;
 	}
-	unicorn_ethdrv = drv = eth_dev->priv;
+	unicorn_ethdrv = drv = netdev_priv(eth_dev);
 	memset(drv, 0, sizeof(struct unicorn_ethdrv));
 #if 	(LINUX_VERSION_CODE open               = unicorn_eth_open;
-	eth_dev->stop               = unicorn_eth_close;
-	eth_dev->do_ioctl           = unicorn_eth_ioctl;
-	eth_dev->change_mtu         = unicorn_eth_change_mtu;
-	eth_dev->hard_start_xmit    = unicorn_eth_send;
-	eth_dev->get_stats          = unicorn_eth_stats;
-	eth_dev->set_multicast_list = unicorn_eth_set_multicast;
-	eth_dev->tx_timeout         = unicorn_eth_tx_timeout;
+	eth_dev->netdev_ops = &unicorn_netdev_ops;
+
 	eth_dev->watchdog_timeo     = HZ*5;

 	return 0;

Results

# modinfo unicorn_usb_eth
filename:       /lib/modules/2.6.31-15-generic/extra/unicorn_usb_eth.ko
license:        GPL
description:    ATM driver for the ST UNICORN II ADSL modem.
author:         ashutosh.sharma@st.com
alias:          usb:v0483p0138d*dc*dsc*dp*ic*isc*ip*
depends:
vermagic:       2.6.31-15-generic SMP mod_unload modversions 586
parm:           if_name:charp
parm:           mac_address:charp
parm:           VPI:int
parm:           VCI:int
parm:           PROTOCOL:charp
parm:           ENCAPS:charp
parm:           ActivationMode:long
parm:           AlternativeSetting:long
parm:           AutoActivation:long
parm:           DownstreamRate:long
parm:           LoopbackMode:long
parm:           MswDebugLevel:long
parm:           RetryTime:long
parm:           DebugLevel:long
parm:           ledScenario:long

Source

Download: zxdslv2-2.6.31.diff

References

API changes in the 2.6 kernel series

2 grudnia 2009 at 20:57 18 Komentarzy


Kalendarz

Grudzień 2009
Pon W Śr Czw Pt S N
 123456
78910111213
14151617181920
21222324252627
28293031  

Posts by Month

Posts by Category