Hi Greg,

it shows no adverse effects. Please apply.

        Regards
                Oliver

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2002-04-13 23:21:08+02:00, [EMAIL PROTECTED]
  - add link state reporting
  - fix an urb usage counting bug




diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c  Sat Apr 13 23:22:38 2002
+++ b/drivers/usb/net/kaweth.c  Sat Apr 13 23:22:38 2002
@@ -100,6 +100,12 @@
 
 #define KAWETH_SOFS_TO_WAIT                    0x05
 
+#define INTBUFFERSIZE                          4
+
+#define STATE_OFFSET                           0
+#define STATE_MASK                             0x40
+#define        STATE_SHIFT                             5
+
 
 MODULE_AUTHOR("Michael Zappe <[EMAIL PROTECTED]>, Stephane Alnet 
<[EMAIL PROTECTED]>, Brad Hards <[EMAIL PROTECTED]> and Oliver Neukum 
<[EMAIL PROTECTED]>");
 MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver");
@@ -204,6 +210,7 @@
        int end;
        int removed;
        int suspend_lowmem;
+       int linkstate;
 
        struct usb_device *dev;
        struct net_device *net;
@@ -216,6 +223,7 @@
        __u8 firmware_buf[KAWETH_FIRMWARE_BUF_SIZE];
        __u8 tx_buf[KAWETH_BUF_SIZE];
        __u8 rx_buf[KAWETH_BUF_SIZE];
+       __u8 intbuffer[INTBUFFERSIZE];
        __u16 packet_filter_bitmap;
 
        struct kaweth_ethernet_configuration configuration;
@@ -450,17 +458,40 @@
 }
 
 static void kaweth_usb_receive(struct urb *);
+static void kaweth_resubmit_rx_urb(struct kaweth_device *, int);
+
+/****************************************************************
+       int_callback
+*****************************************************************/
+static void int_callback(struct urb *u)
+{
+       struct kaweth_device *kaweth = u->context;
+       int act_state;
+
+       /* we abuse the interrupt urb for rebsubmitting under low memory saving a 
+timer */
+       if (kaweth->suspend_lowmem)
+               kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC);
+
+       /* we check the link state to report changes */
+       if (kaweth->linkstate != (act_state = ( kaweth->intbuffer[STATE_OFFSET] | 
+STATE_MASK) >> STATE_SHIFT)) {
+               if (!act_state)
+                       netif_carrier_on(kaweth->net);
+               else
+                       netif_carrier_off(kaweth->net);
+
+               kaweth->linkstate = act_state;
+       }
+
+}
 
 /****************************************************************
  *     kaweth_resubmit_rx_urb
  ****************************************************************/
-static inline void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
+static void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
                                                int mem_flags)
 {
        int result;
 
-       memset(kaweth->rx_urb, 0, sizeof(*kaweth->rx_urb));
-
        FILL_BULK_URB(kaweth->rx_urb,
                      kaweth->dev,
                      usb_rcvbulkpipe(kaweth->dev, 1),
@@ -563,6 +594,18 @@
 
        kaweth_resubmit_rx_urb(kaweth, GFP_KERNEL);
 
+       FILL_INT_URB(
+               kaweth->irq_urb,
+               kaweth->dev,
+               usb_rcvintpipe(kaweth->dev, 3),
+               kaweth->intbuffer,
+               INTBUFFERSIZE,
+               int_callback,
+               kaweth,
+               HZ/4);
+
+       usb_submit_urb(kaweth->irq_urb, GFP_KERNEL);
+
        netif_start_queue(net);
 
        kaweth_async_set_rx_mode(kaweth);
@@ -580,6 +623,7 @@
 
        kaweth->status |= KAWETH_STATUS_CLOSING;
 
+       usb_unlink_urb(kaweth->irq_urb);
        usb_unlink_urb(kaweth->rx_urb);
 
        kaweth->status &= ~KAWETH_STATUS_CLOSING;
@@ -638,8 +682,6 @@
 
        memcpy(kaweth->tx_buf + 2, skb->data, skb->len);
 
-       memset(kaweth->tx_urb, 0, sizeof(*kaweth->tx_urb));
-
        FILL_BULK_URB(kaweth->tx_urb,
                      kaweth->dev,
                      usb_sndbulkpipe(kaweth->dev, 2),
@@ -967,6 +1009,7 @@
        }
 
        kaweth->removed = 1;
+       usb_unlink_urb(kaweth->irq_urb);
        usb_unlink_urb(kaweth->rx_urb);
 
        /* we need to wait for the urb to be cancelled, if it is active */

===================================================================


This BitKeeper patch contains the following changesets:
1.459
## Wrapped with gzip_uu ##


begin 664 bkpatch26460
M'XL(`)ZAN#P``\566V_:2!1^]OR*4^4%TH!GQI<`$5%S@08E;2)(7KJI+%_&
MP0)L.K:35$O_^YZQ$V-:DNVF#VLAV3[?N7[S'8L=N$F%[&G)/+H7DNS`69)F
M^"KB)!;M:;(0\RC.']N)O$-PG"0(ZLJLEQ&Z-VME4HA4?TCDC*#/E9OY4T`H
M[6FL;526[/M2]+3QX./-Q=&8D'X?3J9N?"<F(H-^GWBS#T$NYNV93-RI*K>J
MX!6GE#'&+6I8-K-6O&,8YHK9U`OP,>#[W="SNZ1LZ,.VUC=S<6HR@W:89="5
M:3+:):?`VJ;5!<IU:NK,`&[T..O1SGO*>Y3"*ZGA/8,6)<?PYP.<$!]:X`8!
M8/89I)F;"9!BF<@LBN\*,(P>P8TAEQ[DJ7LGP$_R6*'@Y7?D'-0X^^1J32UI
M_<>+$.I2<KAEG$`J$E(]3SU]YCZ(;-KVUY.9M,OIRN`=9JQLVPX8-5W/=YD5
MV)W7^-M(&XML(W5Q4ISAK;LRJ6E9A6Y>BM@NH[>W_:JB_K5M%)B);7-N,U8(
MC/--?=&>V?T=?9D=:%G_@\"D"(44L?^KR(J3N(26?"A^*)JK%P_E#0(<,<K!
M)CN!"*-8P.CS]?'-<#@83T9?!AI>)KFMP,GUT?7`N1P.)X-KA=&?D$]'D_/"
M_FA6D%9"D[/1L(BQ,-^(4QL8T:(X*\@IN#E`,^LHL^/D'4#,RT,DY:^-EKZB
MFVEQX!9149$/]TD40$F`(T6:>XLH<^2C@ZPVTDSF?O:,!N(^0H)W]U3RY@$V
MHN_^X57,X/CN?.ZY_HS\:;I=?6.J>N[G6918=O,F^9MHVZ<K7Z$/>>O03^),
M/&8')=6NGSE/5-\23=^%!P&NEZ<"LJE0Q824^;(L$282->F5=!9RS.-`2)@G
M#[`0BT1^A]2]5W87LFB!"/:N12$TROJMPS1/ER(.'(S`@";1M!<.J33OP<?A
ME7-T??EI=-*L->A/A3\K&JRM498\;1+":BO37ZI7LH)W?6A4DR,M#7CV64NL
M+NROL*K)N0F'AU"3<+,)R'Q1ZEV550VGX1Y&(1Z7E)&03A)7K2"``VF:F*=B
MBV,8_N1Y6U%5'Z-?/S[M!WK](*>FM8\+,RIO;]Z'IP/`=#8N%AE9M@6,$VTX
MNKAP</N<F_%QH]94)+^I;'LU$Z92K_@]<J2/LLB6T5(TZB@8S7I`Q;TR;FRX
M,M2%OXY23V=?=+/D2-5ZFFZMHG5SA9S.!^//@XO"?V1UN/JXJ+`\5KQN"T/7
B4]MDBH6NW?TM_^H_5Z'4-%_T/2OT`Q\9_`=RG\.M\`D`````
`
end

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to