2.6 Generic HDLC update
Subsystems (3)
Krzysztof Halasa
maintainerPATCH 1/1 2.6 Generic HDLC update
Hi,
The attached patch updates generic HDLC:
- fixed some carrier-related problems (Cisco HDLC and FR links could report valid link when no carrier was detected at startup).
- fixed kbuild problems with wanxl firmware (building kernel in separate tree). $(src)/wanxlfw.inc is now wanxlfw.inc_shipped.
Signature · 1 line
Krzysztof Halasa, B*FH
drivers/net/wan/Makefile +5 -2
@@ -60,6 +60,9 @@ obj-$(CONFIG_C101) += c101.o obj-$(CONFIG_WANXL) += wanxl.o obj-$(CONFIG_PCI200SYN) += pci200syn.o + +clean-files := wanxlfw.inc +$(obj)/wanxl.o: $(obj)/wanxlfw.inc ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y) ifeq ($(ARCH),m68k)
@@ -72,12 +76,12 @@ quiet_cmd_build_wanxlfw = BLD FW $@ cmd_build_wanxlfw = \ - $(CPP) -Wp,-MD,$(depfile) -Iinclude $(obj)/wanxlfw.S | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ + $(CPP) -Wp,-MD,$(depfile) -I$(srctree)/include $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \ $(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \ hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \ rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o -$(obj)/wanxlfw.inc: $(obj)/wanxlfw.S +$(obj)/wanxlfw.inc: $(src)/wanxlfw.S $(call if_changed_dep,build_wanxlfw) targets += wanxlfw.inc endif
drivers/net/wan/c101.c +0 -2
@@ -379,8 +379,6 @@return result; } -/* XXX: are we OK with having that done when card is already up? */ -sca_init_sync_port (card);/* Set up C101 memory */ hdlc_set_carrier (!(sca_in (MSCI1_OFFSET +ST3 , card) &ST3_DCD ), dev);
drivers/net/wan/hdlc_cisco.c +14 -8
@@ -180,7 +180,8 @@case CISCO_KEEPALIVE_REQ : hdlc->state.cisco.rxseq =ntohl (cisco_data->par1); -if (ntohl (cisco_data->par2)==hdlc->state.cisco.txseq) { +if (hdlc->state.cisco.request_sent && +ntohl (cisco_data->par2)==hdlc->state.cisco.txseq) { hdlc->state.cisco.last_poll = jiffies;if (!hdlc->state.cisco.up) {u32 sec, min, hrs, days;
@@ -192,8 +193,9 @@"uptime %ud%uh%um%us)\n" , dev->name, days, hrs, min, sec); +netif_carrier_on (dev); + hdlc->state.cisco.up =1 ; } - hdlc->state.cisco.up =1 ; }dev_kfree_skb_any (skb);
@@ -219,17 +221,18 @@struct net_device *dev = (struct net_device *)arg;hdlc_device *hdlc =dev_to_hdlc (dev); -if (hdlc->state.cisco.up && jiffies - hdlc->state.cisco.last_poll >= - hdlc->state.cisco.settings.timeout *HZ ) { +if (hdlc->state.cisco.up && +time_after (jiffies, hdlc->state.cisco.last_poll + + hdlc->state.cisco.settings.timeout *HZ )) { hdlc->state.cisco.up =0 ;printk (KERN_INFO "%s: Link down\n" , dev->name); -if (netif_carrier_ok (dev)) -netif_carrier_off (dev); +netif_carrier_off (dev); }cisco_keepalive_send (dev,CISCO_KEEPALIVE_REQ , ++hdlc->state.cisco.txseq, hdlc->state.cisco.rxseq); + hdlc->state.cisco.request_sent =1 ; hdlc->state.cisco.timer.expires = jiffies + hdlc->state.cisco.settings.interval *HZ ; hdlc->state.cisco.timer.function = cisco_timer;
@@ -242,8 +245,8 @@static void cisco_start (struct net_device *dev) {hdlc_device *hdlc =dev_to_hdlc (dev); - hdlc->state.cisco.last_poll =0 ; hdlc->state.cisco.up =0 ; + hdlc->state.cisco.request_sent =0 ; hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq =0 ;init_timer (&hdlc->state.cisco.timer);
@@ -257,9 +260,12 @@static void cisco_stop (struct net_device *dev) { -del_timer_sync (&dev_to_hdlc (dev)->state.cisco.timer); +hdlc_device *hdlc =dev_to_hdlc (dev); +del_timer_sync (&hdlc->state.cisco.timer);if (netif_carrier_ok (dev))netif_carrier_off (dev); + hdlc->state.cisco.up =0 ; + hdlc->state.cisco.request_sent =0 ; }
drivers/net/wan/hdlc_fr.c +11 -9
@@ -584,8 +584,9 @@u32 list;if (hdlc->state.fr.settings.dce) - reliable = (jiffies - hdlc->state.fr.last_poll < - hdlc->state.fr.settings.t392 *HZ ); + reliable = hdlc->state.fr.request && +time_before (jiffies, hdlc->state.fr.last_poll + + hdlc->state.fr.settings.t392 *HZ );else { hdlc->state.fr.last_errors <<=1 ;/* Shift the list */ if (hdlc->state.fr.request) {
@@ -617,6 +618,7 @@fr_lmi_send (dev, hdlc->state.fr.n391cnt ==0 ); + hdlc->state.fr.last_poll = jiffies; hdlc->state.fr.request =1 ; hdlc->state.fr.timer.expires = jiffies + hdlc->state.fr.settings.t391 *HZ ;
@@ -689,6 +691,7 @@ dev->name, reptype);return 1 ; } + hdlc->state.fr.last_poll = jiffies; } error =0 ;
@@ -728,7 +731,12 @@/* DTE */ -if (reptype !=LMI_FULLREP || error) + hdlc->state.fr.request =0 ;/* got response, no request pending */ + +if (error) +return 0 ; + +if (reptype !=LMI_FULLREP )return 0 ; stat_len =3 ;
@@ -829,9 +837,6 @@if (fr_lmi_recv (ndev, skb)) goto rx_error;else { -/* No request pending */ - hdlc->state.fr.request =0 ; - hdlc->state.fr.last_poll = jiffies;dev_kfree_skb_any (skb);return NET_RX_SUCCESS ; }
@@ -946,9 +951,6 @@printk (KERN_DEBUG "fr_start\n" );#endif if (hdlc->state.fr.settings.lmi !=LMI_NONE ) { -if (netif_carrier_ok (dev)) -netif_carrier_off (dev); - hdlc->state.fr.last_poll =0 ; hdlc->state.fr.reliable =0 ; hdlc->state.fr.dce_changed =1 ; hdlc->state.fr.request =0 ;
drivers/net/wan/hdlc_generic.c +58 -50
191 lines not on this page · raw message
drivers/net/wan/wanxlfw.inc deleted +0 -158
158 lines not on this page · raw message
drivers/net/wan/wanxlfw.inc_shipped new file +158 -0
158 lines not on this page · raw message
include/linux/hdlc.h +3 -2
@@ -134,7 +134,7 @@int dce_pvc_count;struct timer_list timer; -int last_poll; +unsigned long last_poll;int reliable;int dce_changed;int request;
@@ -149,8 +149,9 @@cisco_proto settings;struct timer_list timer; -int last_poll; +unsigned long last_poll;int up; +int request_sent;u32 txseq;/* TX sequence number */ u32 rxseq;/* RX sequence number */ }cisco;
Jeff Garzik
Appliedapplied