All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 17:59 Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 17:59 UTC (permalink / raw)
  To: linux-kernel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NET] [002] dmfe : Fix possible oops

Deallocate memory after driver is unregistred to prevent oops
Don't dereference NULL pointer that can be returned by dev_alloc_skb in case of oom

Signed-off-by: Maxim Levitsky <maximlevitsky@yahoo.com>

---

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c	2007-02-07 18:27:07.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c	2007-02-07 18:27:59.000000000 +0200
@@ -497,13 +497,16 @@ static void __devexit dmfe_remove_one (s
 	DMFE_DBUG(0, "dmfe_remove_one()", 0);
 
  	if (dev) {
+		
+		unregister_netdev(dev);
+		pci_release_regions(pdev);
+		
+		
 		pci_free_consistent(db->pdev, sizeof(struct tx_desc) *
 					DESC_ALL_CNT + 0x20, db->desc_pool_ptr,
  					db->desc_pool_dma_ptr);
 		pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
 					db->buf_pool_ptr, db->buf_pool_dma_ptr);
-		unregister_netdev(dev);
-		pci_release_regions(pdev);
 		free_netdev(dev);	/* free board information */
 		pci_set_drvdata(pdev, NULL);
 	}
@@ -921,7 +924,7 @@ static inline u32 cal_CRC(unsigned char 
 static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
 {
 	struct rx_desc *rxptr;
-	struct sk_buff *skb;
+	struct sk_buff *skb, *newskb;
 	int rxlen;
 	u32 rdes0;
 
@@ -974,8 +977,10 @@ static void dmfe_rx_packet(struct DEVICE
 					/* Good packet, send to upper layer */
 					/* Shorst packet used new SKB */
 					if ( (rxlen < RX_COPY_SIZE) &&
-						( (skb = dev_alloc_skb(rxlen + 2) )
+						( (newskb = dev_alloc_skb(rxlen + 2) )
 						!= NULL) ) {
+						
+						skb = newskb;
 						/* size less than COPY_SIZE, allocate a rxlen SKB */
 						skb->dev = dev;
 						skb_reserve(skb, 2); /* 16byte align */



 
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
  2007-02-07 19:13 ` Ismail Dönmez
@ 2007-02-07 21:36   ` Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 21:36 UTC (permalink / raw)
  To: ismail; +Cc: linux-kernel

--- Ismail Dönmez <ismail@pardus.org.tr> wrote:

> Hi,
> On Wednesday 07 February 2007 19:57:21 you wrote:
> > Hello,
> >
> > Before some time I decided to fix suspend/resume on my Davicom network
> > card. During development I also fixed couple of bugs and added support for
> > link detection and WOL Note : 2.6.20 already has support for link detection
> > , but it is broken when card has external PHY , like mine.
> >
> > So here it goes:
> >
> > [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> > [PATCH] [NET] [002] dmfe : Fix possible oops
> > [PATCH] [NET] [003] dmfe : fix link detection
> > [PATCH] [NET] [004] dmfe : Add suspend/resume support
> > [PATCH] [NET] [005] dmfe : Add support for wake-on-lan
> 
> 
> CC netdev@vger.kernel.org for network patches.
> 
> Regards,
> ismail
> 

I sended all pathes again and I CC'd both maintainer and netdev@vger.kernel.org

     Sincerely,
        Maxim Levitsky


 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
  2007-02-07 17:57 Levitsky Maxim
  2007-02-07 18:03 ` Randy Dunlap
@ 2007-02-07 19:13 ` Ismail Dönmez
  2007-02-07 21:36   ` Levitsky Maxim
  1 sibling, 1 reply; 10+ messages in thread
From: Ismail Dönmez @ 2007-02-07 19:13 UTC (permalink / raw)
  To: Levitsky Maxim; +Cc: linux-kernel

Hi,
On Wednesday 07 February 2007 19:57:21 you wrote:
> Hello,
>
> Before some time I decided to fix suspend/resume on my Davicom network
> card. During development I also fixed couple of bugs and added support for
> link detection and WOL Note : 2.6.20 already has support for link detection
> , but it is broken when card has external PHY , like mine.
>
> So here it goes:
>
> [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> [PATCH] [NET] [002] dmfe : Fix possible oops
> [PATCH] [NET] [003] dmfe : fix link detection
> [PATCH] [NET] [004] dmfe : Add suspend/resume support
> [PATCH] [NET] [005] dmfe : Add support for wake-on-lan


CC netdev@vger.kernel.org for network patches.

Regards,
ismail

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
  2007-02-07 18:03 ` Randy Dunlap
@ 2007-02-07 18:16   ` Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 18:16 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kernel


--- Randy Dunlap <randy.dunlap@oracle.com> wrote:

> On Wed, 7 Feb 2007 09:57:21 -0800 (PST) Levitsky Maxim wrote:
> 
> > Hello,
> > 
> > Before some time I decided to fix suspend/resume on my Davicom network card.
> > During development I also fixed couple of bugs and added support for link detection and WOL
> > Note : 2.6.20 already has support for link detection , but it is broken when card has external
> PHY
> > , like mine.
> > 
> > So here it goes:
> > 
> > [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> > [PATCH] [NET] [002] dmfe : Fix possible oops
> > [PATCH] [NET] [003] dmfe : fix link detection
> > [PATCH] [NET] [004] dmfe : Add suspend/resume support
> > [PATCH] [NET] [005] dmfe : Add support for wake-on-lan
> 
> Hi,
> Please use a different Subject: line for each patch (like you have
> listed them above).
> 
> Also, please send network driver patches to netdev@vger.kernel.org .
> 
> Oops, MAINTAINERS should list netdev@ for DMFE.
> And it does list a maintainer for DMFE, so you should cc: him on
> the patches.
> 
> Thanks.
> ---
> ~Randy
> 

Thanks , its first time I post patches here.
    Maxim levitsky


 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 18:04 Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 18:04 UTC (permalink / raw)
  To: linux-kernel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NET] [005] dmfe : Add support for wake-on-lan

Adds support for wake on lan feature

Signed-off-by: Maxim Levitsky <maximlevitsky@yahoo.com>

---

This board supports WOL on magic packet / link change / specific packet
This adds support for WOL on magic packet / link change

Note : WOL is enabled when you suspend system ether to disk or ram, and is not enabled when you
turn system off


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c	2007-02-07 18:53:19.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c	2007-02-07 18:55:44.000000000 +0200
@@ -122,6 +122,11 @@
 #define DM9801_NOISE_FLOOR 8
 #define DM9802_NOISE_FLOOR 5
 
+#define DMFE_WOL_LINKCHANGE	0x20000000
+#define DMFE_WOL_SAMPLEPACKET	0x10000000
+#define DMFE_WOL_MAGICPACKET	0x08000000
+
+
 #define DMFE_10MHF      0
 #define DMFE_100MHF     1
 #define DMFE_10MFD      4
@@ -242,6 +247,7 @@ struct dmfe_board_info {
 	u8 wait_reset;			/* Hardware failed, need to reset */
 	u8 dm910x_chk_mode;		/* Operating mode check */
 	u8 first_in_callback;		/* Flag to record state */
+	u8 wol_mode;			/* user WOL settings */
 	struct timer_list timer;
 
 	/* System defined statistic counter */
@@ -423,6 +429,7 @@ static int __devinit dmfe_init_one (stru
 	db->chip_id = ent->driver_data;
 	db->ioaddr = pci_resource_start(pdev, 0);
 	db->chip_revision = dev_rev;
+	db->wol_mode = 0;
 
 	db->pdev = pdev;
 
@@ -1054,7 +1061,11 @@ static void dmfe_set_filter_mode(struct 
 	spin_unlock_irqrestore(&db->lock, flags);
 }
 
-static void netdev_get_drvinfo(struct net_device *dev,
+/*
+ * 	Ethtool interace 
+ */
+
+static void dmfe_ethtool_get_drvinfo(struct net_device *dev,
 			       struct ethtool_drvinfo *info)
 {
 	struct dmfe_board_info *np = netdev_priv(dev);
@@ -1068,9 +1079,35 @@ static void netdev_get_drvinfo(struct ne
 			dev->base_addr, dev->irq);
 }
 
+static int dmfe_ethtool_set_wol(struct net_device *dev, 
+				struct ethtool_wolinfo *wolinfo)
+{
+	struct dmfe_board_info *db = netdev_priv(dev);
+	
+	if (wolinfo->wolopts & (WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | 
+		   		WAKE_ARP | WAKE_MAGICSECURE))
+		   return -EOPNOTSUPP;
+	
+	db->wol_mode = wolinfo->wolopts;
+	return 0;
+}
+
+static void dmfe_ethtool_get_wol(struct net_device *dev, 
+				 struct ethtool_wolinfo *wolinfo)
+{
+	struct dmfe_board_info *db = netdev_priv(dev);
+	
+	wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
+	wolinfo->wolopts = db->wol_mode;
+	return;
+}
+
+
 static const struct ethtool_ops netdev_ethtool_ops = {
-	.get_drvinfo		= netdev_get_drvinfo,
+	.get_drvinfo		= dmfe_ethtool_get_drvinfo,
 	.get_link               = ethtool_op_get_link,
+	.set_wol		= dmfe_ethtool_set_wol,
+	.get_wol		= dmfe_ethtool_get_wol,
 };
 
 /*
@@ -2046,6 +2083,20 @@ static int dmfe_suspend(struct pci_dev *
     /* Fre RX buffers */
     dmfe_free_rxbuffer(db);
 
+    /* Enable WOL */
+    pci_read_config_dword(pci_dev, 0x40, &tmp);
+    tmp &= ~(WAKE_PHY|WAKE_MAGIC);
+    
+    if (db->wol_mode & WAKE_PHY)
+	    tmp |= DMFE_WOL_LINKCHANGE;
+    if (db->wol_mode & WAKE_MAGIC)
+	    tmp |= DMFE_WOL_MAGICPACKET;
+    
+    pci_write_config_dword(pci_dev, 0x40, tmp);
+    
+    pci_enable_wake(pci_dev, PCI_D3hot, 1);
+    pci_enable_wake(pci_dev, PCI_D3cold, 1);
+    
     /* Power down device*/
     pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
     pci_save_state(pci_dev);
@@ -2064,6 +2115,15 @@ static int dmfe_resume(struct pci_dev *p
     /* Re-initilize DM910X board */
     dmfe_init_dm910x(dev);
         
+    /* Disable WOL */
+    pci_read_config_dword(pci_dev, 0x40, &tmp);
+    
+    tmp &= (DMFE_WOL_LINKCHANGE | DMFE_WOL_MAGICPACKET);
+    pci_write_config_dword(pci_dev, 0x40, tmp);
+    
+    pci_enable_wake(pci_dev, PCI_D3hot, 0);
+    pci_enable_wake(pci_dev, PCI_D3cold, 0);
+    
     /* Restart upper layer interface */
     netif_device_attach(dev);
 



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
  2007-02-07 17:57 Levitsky Maxim
@ 2007-02-07 18:03 ` Randy Dunlap
  2007-02-07 18:16   ` Levitsky Maxim
  2007-02-07 19:13 ` Ismail Dönmez
  1 sibling, 1 reply; 10+ messages in thread
From: Randy Dunlap @ 2007-02-07 18:03 UTC (permalink / raw)
  To: Levitsky Maxim; +Cc: linux-kernel

On Wed, 7 Feb 2007 09:57:21 -0800 (PST) Levitsky Maxim wrote:

> Hello,
> 
> Before some time I decided to fix suspend/resume on my Davicom network card.
> During development I also fixed couple of bugs and added support for link detection and WOL
> Note : 2.6.20 already has support for link detection , but it is broken when card has external PHY
> , like mine.
> 
> So here it goes:
> 
> [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> [PATCH] [NET] [002] dmfe : Fix possible oops
> [PATCH] [NET] [003] dmfe : fix link detection
> [PATCH] [NET] [004] dmfe : Add suspend/resume support
> [PATCH] [NET] [005] dmfe : Add support for wake-on-lan

Hi,
Please use a different Subject: line for each patch (like you have
listed them above).

Also, please send network driver patches to netdev@vger.kernel.org .

Oops, MAINTAINERS should list netdev@ for DMFE.
And it does list a maintainer for DMFE, so you should cc: him on
the patches.

Thanks.
---
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 18:00 Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 18:00 UTC (permalink / raw)
  To: linux-kernel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NET] [004] dmfe : Add suspend/resume support

Adds support for suspend/resume

---


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c	2007-02-07 18:46:13.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c	2007-02-07 18:50:52.000000000 +0200
@@ -55,9 +55,6 @@
 
     TODO
 
-    Implement pci_driver::suspend() and pci_driver::resume()
-    power management methods.
-
     Check on 64 bit boxes.
     Check and fix on big endian boxes.
 
@@ -2027,11 +2024,59 @@ static struct pci_device_id dmfe_pci_tbl
 MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl);
 
 
+
+static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
+{
+    u32 tmp;
+
+    struct net_device *dev = pci_get_drvdata(pci_dev);
+    struct dmfe_board_info *db = netdev_priv(dev);
+    
+    /* Disable upper layer interface */
+    netif_device_detach(dev);
+    
+    /* Disable Tx/Rx */
+    db->cr6_data &= ~(CR6_RXSC | CR6_TXSC);	
+    update_cr6(db->cr6_data, dev->base_addr);
+    
+    /* Disable Interrupt */
+    outl(0, dev->base_addr + DCR7);		
+    outl(inl(dev->base_addr + DCR5), dev->base_addr + DCR5);
+    
+    /* Fre RX buffers */
+    dmfe_free_rxbuffer(db);
+
+    /* Power down device*/
+    pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
+    pci_save_state(pci_dev);
+
+    return 0;
+}
+
+static int dmfe_resume(struct pci_dev *pci_dev)
+{
+    struct net_device *dev = pci_get_drvdata(pci_dev);
+    u32 tmp;
+
+    pci_restore_state(pci_dev);
+    pci_set_power_state(pci_dev ,PCI_D0);
+    
+    /* Re-initilize DM910X board */
+    dmfe_init_dm910x(dev);
+        
+    /* Restart upper layer interface */
+    netif_device_attach(dev);
+
+    return 0;
+}
+
 static struct pci_driver dmfe_driver = {
 	.name		= "dmfe",
 	.id_table	= dmfe_pci_tbl,
 	.probe		= dmfe_init_one,
 	.remove		= __devexit_p(dmfe_remove_one),
+        .suspend        = dmfe_suspend,
+        .resume         = dmfe_resume
 };
 
 MODULE_AUTHOR("Sten Wang, sten_wang@davicom.com.tw");



 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 18:00 Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 18:00 UTC (permalink / raw)
  To: linux-kernel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NET] [003] dmfe : fix link detection

Cleanup link detection
Fix link not detected when using external PHY

Signed-off-by: Maxim Levitsky <maximlevitsky@yahoo.com>

---

CR12's bits 0 and 1 show link status/speed only for internal PHY.
In case external one is used, only bit 6 shows link status via special line , and can be left
unnconected
Thus we need to check bit 6 and also query PHY for link status
Note: internal phy is standard phy , so will indicate link status too.

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c	2007-02-07 18:40:33.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c	2007-02-07 18:44:01.000000000 +0200
@@ -147,7 +147,7 @@
 	printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
 #define SHOW_MEDIA_TYPE(mode) \
-	printk(KERN_ERR DRV_NAME ": \
+	printk(KERN_INFO DRV_NAME ": \
 	Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
 	mode & 4 ? "full":"half");
 
@@ -242,7 +242,6 @@ struct dmfe_board_info {
 	u8 media_mode;			/* user specify media mode */
 	u8 op_mode;			/* real work media mode */
 	u8 phy_addr;
-	u8 link_failed;			/* Ever link failed */
 	u8 wait_reset;			/* Hardware failed, need to reset */
 	u8 dm910x_chk_mode;		/* Operating mode check */
 	u8 first_in_callback;		/* Flag to record state */
@@ -536,7 +535,6 @@ static int dmfe_open(struct DEVICE *dev)
 	db->tx_packet_cnt = 0;
 	db->tx_queue_cnt = 0;
 	db->rx_avail_cnt = 0;
-	db->link_failed = 1;
 	db->wait_reset = 0;
 
 	db->first_in_callback = 0;
@@ -1091,6 +1089,8 @@ static void dmfe_timer(unsigned long dat
 	struct dmfe_board_info *db = netdev_priv(dev);
  	unsigned long flags;
 
+	int link_ok, link_ok_phy;
+
 	DMFE_DBUG(0, "dmfe_timer()", 0);
 	spin_lock_irqsave(&db->lock, flags);
 
@@ -1155,22 +1155,45 @@ static void dmfe_timer(unsigned long dat
 	else
 		tmp_cr12 = inb(db->ioaddr + DCR12);	/* DM9102/DM9102A */
 
+	
 	if ( ((db->chip_id == PCI_DM9102_ID) &&
 		(db->chip_revision == 0x02000030)) ||
 		((db->chip_id == PCI_DM9132_ID) &&
 		(db->chip_revision == 0x02000010)) ) {
 		/* DM9102A Chip */
 		if (tmp_cr12 & 2)
-			tmp_cr12 = 0x0;		/* Link failed */
+			link_ok = 0;
 		else
-			tmp_cr12 = 0x3;	/* Link OK */
+			link_ok = 1;
+	}
+	else
+		/*0x43 is used instead of 0x3 because bit 6 should be 
+			connected to external PHY and specify its link status.*/
+		link_ok = (tmp_cr12 & 0x43) ? 1 : 0;
+	
+	
+	/* If chip reports that link is failed it could be because external 
+		PHY is not conected correctly to chip (through pin 89).
+		To be sure ask PHY too.
+	*/
+	
+	/* need a dummy read because of PHY's register latch*/
+	phy_read (db->ioaddr, db->phy_addr, 1, db->chip_id); 
+	link_ok_phy = (phy_read (db->ioaddr, 
+		       db->phy_addr, 1, db->chip_id) & 0x4) ? 1 : 0;
+	
+
+	
+	if (link_ok_phy != link_ok) {
+		DMFE_DBUG (0, "PHY and chip report different link status", 0);
+		link_ok = link_ok | link_ok_phy;
 	}
 
-	if ( !(tmp_cr12 & 0x3) && !db->link_failed ) {
+	if ( !link_ok && netif_carrier_ok(dev) ) {
 		/* Link Failed */
 		DMFE_DBUG(0, "Link Failed", tmp_cr12);
-		db->link_failed = 1;
-		netif_carrier_off(db->dev);
+		
+		netif_carrier_off(dev);
 
 		/* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
 		/* AUTO or force 1M Homerun/Longrun don't need */
@@ -1184,19 +1207,17 @@ static void dmfe_timer(unsigned long dat
 			db->cr6_data&=~0x00000200;	/* bit9=0, HD mode */
 			update_cr6(db->cr6_data, db->ioaddr);
 		}
-	} else
-		if ((tmp_cr12 & 0x3) && db->link_failed) {
-			DMFE_DBUG(0, "Link link OK", tmp_cr12);
-			db->link_failed = 0;
+		
+	} else if (!netif_carrier_ok(dev)) {
+		
+		DMFE_DBUG(0, "Link OK", tmp_cr12);
 
 			/* Auto Sense Speed */
-			if ( (db->media_mode & DMFE_AUTO) &&
-				dmfe_sense_speed(db) )
-				db->link_failed = 1;
-			else
-				netif_carrier_on(db->dev);
+		if (! (db->media_mode & DMFE_AUTO) || !dmfe_sense_speed(db)) {
+			netif_carrier_on(dev);
+			SHOW_MEDIA_TYPE(db->op_mode);
+		}
 			dmfe_process_mode(db);
-			/* SHOW_MEDIA_TYPE(db->op_mode); */
 		}
 
 	/* HPNA remote command check */
@@ -1243,7 +1264,7 @@ static void dmfe_dynamic_reset(struct DE
 	db->tx_packet_cnt = 0;
 	db->tx_queue_cnt = 0;
 	db->rx_avail_cnt = 0;
-	db->link_failed = 1;
+	netif_carrier_off(dev);
 	db->wait_reset = 0;
 
 	/* Re-initilize DM910X board */



 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 17:59 Levitsky Maxim
  0 siblings, 0 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 17:59 UTC (permalink / raw)
  To: linux-kernel

From: Maxim Levitsky <maximlevitsky@yahoo.com>
Subject: [PATCH] [NET] [001] dmfe : trivial/spelling fixes

Fix a typo, and wrap lines on 80-th column

Signed-off-by: Maxim Levitsky <maximlevitsky@yahoo.com>

---

--- linux-2.6.20-org/drivers/net/tulip/dmfe.c	2007-02-03 11:47:52.000000000 +0200
+++ linux-2.6.20-mod/drivers/net/tulip/dmfe.c	2007-02-07 14:41:29.000000000 +0200
@@ -143,9 +145,13 @@
 #define DMFE_TX_TIMEOUT ((3*HZ)/2)	/* tx packet time-out time 1.5 s" */
 #define DMFE_TX_KICK 	(HZ/2)	/* tx packet Kick-out time 0.5 s" */
 
-#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) printk(KERN_ERR DRV_NAME ":
%s %lx\n", (msg), (long) (value))
+#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) \
+	printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
-#define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to %sMhz %s duplex\n",mode
& 1 ?"100":"10", mode & 4 ? "full":"half");
+#define SHOW_MEDIA_TYPE(mode) \
+	printk(KERN_ERR DRV_NAME ": \
+	Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
+	mode & 4 ? "full":"half");
 
 
 /* CR9 definition: SROM/MII */
@@ -163,10 +169,17 @@
 
 #define SROM_V41_CODE   0x14
 
-#define SROM_CLK_WRITE(data, ioaddr)
outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+#define SROM_CLK_WRITE(data, ioaddr) \
+	outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);\
+	outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);\
+	outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+
+#define __CHK_IO_SIZE(pci_id, dev_rev) \
+	( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x02000030) ) ? \
+	DM9102A_IO_SIZE: DM9102_IO_SIZE
 
-#define __CHK_IO_SIZE(pci_id, dev_rev) ( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x02000030) )
? DM9102A_IO_SIZE: DM9102_IO_SIZE
-#define CHK_IO_SIZE(pci_dev, dev_rev) __CHK_IO_SIZE(((pci_dev)->device << 16) |
(pci_dev)->vendor, dev_rev)
+#define CHK_IO_SIZE(pci_dev, dev_rev) \
+	__CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, dev_rev)
 
 /* Sten Check */
 #define DEVICE net_device
@@ -329,7 +342,7 @@ static void dmfe_program_DM9802(struct d
 static void dmfe_HPNA_remote_cmd_chk(struct dmfe_board_info * );
 static void dmfe_set_phyxcer(struct dmfe_board_info *);
 
-/* DM910X network baord routine ---------------------------- */
+/* DM910X network board routine ---------------------------- */
 
 /*
  *	Search DM910X board ,allocate space and register it
@@ -402,8 +415,11 @@ static int __devinit dmfe_init_one (stru
 	db->dev = dev;
 
 	/* Allocate Tx/Rx descriptor memory */
-	db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
&db->desc_pool_dma_ptr);
-	db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
&db->buf_pool_dma_ptr);
+	db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) 
+			* DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
+	
+	db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC 
+			* TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
 
 	db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
 	db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -440,7 +457,8 @@ static int __devinit dmfe_init_one (stru
 
 	/* read 64 word srom data */
 	for (i = 0; i < 64; i++)
-		((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i));
+		((u16 *) db->srom)[i] = 
+			cpu_to_le16(read_srom_word(db->ioaddr, i));
 
 	/* Set Node address */
 	for (i = 0; i < 6; i++)
@@ -722,7 +742,8 @@ static int dmfe_stop(struct DEVICE *dev)
 
 #if 0
 	/* show statistic counter */
-	printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx RESET:%lx RCR8:%lx FAL:%lx
TT:%lx\n",
+	printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx 
+		RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n",
 		db->tx_fifo_underrun, db->tx_excessive_collision,
 		db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier,
 		db->tx_jabber_timeout, db->reset_count, db->reset_cr8,
@@ -919,7 +940,8 @@ static void dmfe_rx_packet(struct DEVICE
 		db->rx_avail_cnt--;
 		db->interval_rx_cnt++;
 
-		pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
+		pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), 
+				 RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
 		if ( (rdes0 & 0x300) != 0x300) {
 			/* A packet without First/Last flag */
 			/* reuse this SKB */
@@ -1259,7 +1334,8 @@ static void dmfe_reuse_skb(struct dmfe_b
 
 	if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) {
 		rxptr->rx_skb_ptr = skb;
-		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE,
PCI_DMA_FROMDEVICE) );
+		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, 
+					    RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
 		wmb();
 		rxptr->rdes0 = cpu_to_le32(0x80000000);
 		db->rx_avail_cnt++;
@@ -1470,7 +1546,8 @@ static void allocate_rx_buffer(struct dm
 		if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL )
 			break;
 		rxptr->rx_skb_ptr = skb; /* FIXME (?) */
-		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, RX_ALLOC_SIZE,
PCI_DMA_FROMDEVICE) );
+		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->data, 
+					    RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) );
 		wmb();
 		rxptr->rdes0 = cpu_to_le32(0x80000000);
 		rxptr = rxptr->next_rx_desc;
@@ -1663,7 +1740,8 @@ static void dmfe_process_mode(struct dmf
  *	Write a word to Phy register
  */
 
-static void phy_write(unsigned long iobase, u8 phy_addr, u8 offset, u16 phy_data, u32 chip_id)
+static void phy_write(unsigned long iobase, u8 phy_addr, u8 offset, 
+		      u16 phy_data, u32 chip_id)
 {
 	u16 i;
 	unsigned long ioaddr;



 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [NET] dmfe : number of fixes and features
@ 2007-02-07 17:57 Levitsky Maxim
  2007-02-07 18:03 ` Randy Dunlap
  2007-02-07 19:13 ` Ismail Dönmez
  0 siblings, 2 replies; 10+ messages in thread
From: Levitsky Maxim @ 2007-02-07 17:57 UTC (permalink / raw)
  To: linux-kernel

Hello,

Before some time I decided to fix suspend/resume on my Davicom network card.
During development I also fixed couple of bugs and added support for link detection and WOL
Note : 2.6.20 already has support for link detection , but it is broken when card has external PHY
, like mine.

So here it goes:

[PATCH] [NET] [001] dmfe : trivial/spelling fixes
[PATCH] [NET] [002] dmfe : Fix possible oops
[PATCH] [NET] [003] dmfe : fix link detection
[PATCH] [NET] [004] dmfe : Add suspend/resume support
[PATCH] [NET] [005] dmfe : Add support for wake-on-lan

        Maxim Levitsky


 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-02-07 21:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 17:59 [PATCH] [NET] dmfe : number of fixes and features Levitsky Maxim
  -- strict thread matches above, loose matches on Subject: below --
2007-02-07 18:04 Levitsky Maxim
2007-02-07 18:00 Levitsky Maxim
2007-02-07 18:00 Levitsky Maxim
2007-02-07 17:59 Levitsky Maxim
2007-02-07 17:57 Levitsky Maxim
2007-02-07 18:03 ` Randy Dunlap
2007-02-07 18:16   ` Levitsky Maxim
2007-02-07 19:13 ` Ismail Dönmez
2007-02-07 21:36   ` Levitsky Maxim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.