Hi, this fixes the coherency problems in catc.
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], 2003-08-05 19:49:14+02:00, [EMAIL PROTECTED] - fix dma cache coherency issues catc.c | 97 +++++++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 59 insertions(+), 38 deletions(-) diff -Nru a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c --- a/drivers/usb/net/catc.c Tue Aug 5 19:49:57 2003 +++ b/drivers/usb/net/catc.c Tue Aug 5 19:49:57 2003 @@ -7,7 +7,7 @@ * * Based on the work of * Donald Becker - * + * * Old chipset support added by Simon Evans <[EMAIL PROTECTED]> 2002 * - adds support for Belkin F5U011 */ @@ -15,18 +15,18 @@ /* * 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 + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <[EMAIL PROTECTED]>, or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -67,7 +67,7 @@ /* * Some defines. - */ + */ #define STATS_UPDATE (HZ) /* Time between stats updates */ #define TX_TIMEOUT (5*HZ) /* Max time the queue can be stopped */ @@ -172,8 +172,8 @@ u8 tx_buf[2][TX_MAX_BURST * (PKT_SZ + 2)]; u8 rx_buf[RX_MAX_BURST * (PKT_SZ + 2)]; - u8 irq_buf[2]; - u8 ctrl_buf[64]; + u8 * irq_buf; + u8 * ctrl_buf;//[64]; struct usb_ctrlrequest ctrl_dr; struct timer_list timer; @@ -637,7 +637,7 @@ if (netdev->flags & IFF_PROMISC) { memset(catc->multicast, 0xff, 64); rx |= (!catc->is_f5u011) ? RxPromisc : AltRxPromisc; - } + } if (netdev->flags & IFF_ALLMULTI) { memset(catc->multicast, 0xff, 64); @@ -671,7 +671,7 @@ { struct catc *catc = dev->priv; u32 cmd; - + if (get_user(cmd, (u32 *)useraddr)) return -EFAULT; @@ -690,17 +690,17 @@ /* get settings */ case ETHTOOL_GSET: if (catc->is_f5u011) { - struct ethtool_cmd ecmd = { ETHTOOL_GSET, - SUPPORTED_10baseT_Half | SUPPORTED_TP, - ADVERTISED_10baseT_Half | ADVERTISED_TP, - SPEED_10, - DUPLEX_HALF, - PORT_TP, - 0, - XCVR_INTERNAL, - AUTONEG_DISABLE, - 1, - 1 + struct ethtool_cmd ecmd = { ETHTOOL_GSET, + SUPPORTED_10baseT_Half | SUPPORTED_TP, + ADVERTISED_10baseT_Half | ADVERTISED_TP, + SPEED_10, + DUPLEX_HALF, + PORT_TP, + 0, + XCVR_INTERNAL, + AUTONEG_DISABLE, + 1, + 1 }; if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) return -EFAULT; @@ -718,7 +718,7 @@ return 0; } } - + return -EOPNOTSUPP; } @@ -797,8 +797,23 @@ memset(catc, 0, sizeof(struct catc)); + catc->irq_buf = kmalloc(2, GFP_KERNEL); + if (!catc->irq_buf) { + kfree(catc); + return -ENOMEM; + } + + catc->ctrl_buf = kmalloc(64, GFP_KERNEL); + if (!catc->ctrl_buf) { + kfree(catc->irq_buf); + kfree(catc); + return -ENOMEM; + } + netdev = alloc_etherdev(0); if (!netdev) { + kfree(catc->irq_buf); + kfree(catc->ctrl_buf); kfree(catc); return -EIO; } @@ -827,7 +842,7 @@ catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL); catc->rx_urb = usb_alloc_urb(0, GFP_KERNEL); catc->irq_urb = usb_alloc_urb(0, GFP_KERNEL); - if ((!catc->ctrl_urb) || (!catc->tx_urb) || + if ((!catc->ctrl_urb) || (!catc->tx_urb) || (!catc->rx_urb) || (!catc->irq_urb)) { err("No free urbs available."); if (catc->ctrl_urb) @@ -839,6 +854,8 @@ if (catc->irq_urb) usb_free_urb(catc->irq_urb); kfree(netdev); + kfree(catc->irq_buf); + kfree(catc->ctrl_buf); kfree(catc); return -ENOMEM; } @@ -847,13 +864,13 @@ if (usbdev->descriptor.idVendor == 0x0423 && usbdev->descriptor.idProduct == 0xa && catc->usbdev->descriptor.bcdDevice == 0x0130 ) { dbg("Testing for f5u011"); - catc->is_f5u011 = 1; + catc->is_f5u011 = 1; atomic_set(&catc->recq_sz, 0); pktsz = RX_PKT_SZ; } else { pktsz = RX_MAX_BURST * (PKT_SZ + 2); } - + usb_fill_control_urb(catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0), NULL, NULL, 0, catc_ctrl_done, catc); @@ -871,10 +888,10 @@ i = 0x12345678; catc_write_mem(catc, 0x7a80, &i, 4); - i = 0x87654321; + i = 0x87654321; catc_write_mem(catc, 0xfa80, &i, 4); catc_read_mem(catc, 0x7a80, &i, 4); - + switch (i) { case 0x12345678: catc_set_reg(catc, TxBufCount, 8); @@ -889,31 +906,31 @@ dbg("32k Memory\n"); break; } - + dbg("Getting MAC from SEEROM."); - + catc_get_mac(catc, netdev->dev_addr); - + dbg("Setting MAC into registers."); - + for (i = 0; i < 6; i++) catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]); - + dbg("Filling the multicast list."); - + memset(broadcast, 0xff, 6); catc_multicast(broadcast, catc->multicast); catc_multicast(netdev->dev_addr, catc->multicast); catc_write_mem(catc, 0xfa80, catc->multicast, 64); - + dbg("Clearing error counters."); - + for (i = 0; i < 8; i++) catc_set_reg(catc, EthStats + i, 0); catc->last_stats = jiffies; - + dbg("Enabling."); - + catc_set_reg(catc, MaxBurst, RX_MAX_BURST); catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits); catc_set_reg(catc, LEDCtrl, LEDLink); @@ -922,7 +939,7 @@ dbg("Performing reset\n"); catc_reset(catc); catc_get_mac(catc, netdev->dev_addr); - + dbg("Setting RX Mode"); catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast; catc->rxmode[1] = 0; @@ -944,6 +961,8 @@ usb_free_urb(catc->rx_urb); usb_free_urb(catc->irq_urb); kfree(netdev); + kfree(catc->irq_buf); + kfree(catc->ctrl_buf); kfree(catc); return -EIO; } @@ -962,6 +981,8 @@ usb_free_urb(catc->rx_urb); usb_free_urb(catc->irq_urb); kfree(catc->netdev); + kfree(catc->irq_buf); + kfree(catc->ctrl_buf); kfree(catc); } } =================================================================== This BitKeeper patch contains the following changesets: 1.2153 ## Wrapped with gzip_uu ## begin 664 bkpatch20743 M'XL(`$7N+S\``ZU6:V_:2!3];/[EMAIL PROTECTED],WX.$572X"2H-"[EMAIL PROTECTED]:6F0L:, [EMAIL PROTECTED]>K^][V>B1-HTRB;70MQ?>:^CN<>C_P:+G.1=;4TCOX6F?X:SM.\ MZ&IXORF7(FDGHER7FW::7:-ODJ;HZZS2C>BHA,XL$R+OE/FBQ=J6CC%COPA6 [EMAIL PROTECTED]&V<;]2W'X576WBG5T.CR>ZWNO!R<I/KL54%-#KZ8OUT;(4<7N=I?ZJ M;E?=NRM&"*646<2P;&I5S#4,LZ(V62SQ=LD<'BYLKBM"1X\PWRUE$)>8U*&< M\LIFW&)Z'VB;4<L`8G2(VR$64-XU>9>:;PCK$@)[EMAIL PROTECTED]([EMAIL PROTECTED]/8`6 MA-$-+#<^!'ZP$A"D*Y&))+B%*,]+D>OOP3:HP?7QP^[IK7]YZ3KQB?[V$<K+ MK'Y..<[EMAIL PROTECTED]<3<(90>Z.RRLK"[EMAIL PROTECTED]/[LU,R$<56V7H.%G5, M3EEE<LXL*8K'[EMAIL PROTECTED](^**`_\.&I'Q>?K3%Q_>9*M8Q"TCDDJ MZC+B2M68[F^:8<_0C,6A9;C_HVK\.$Z1JX!%&8;X`!"F&8HG*;(TABA!M/&+ [EMAIL PROTECTED]'Q+4I)[?H(6MEW^4-IC/[EMAIL PROTECTED]>(K$\)4'[EMAIL PROTECTED]/ M\>R`:1H6W_T,45HF2\GR$$2$_DR>(C5K!FDH,X91())<'$":Z7TFZ[.F/K,D MM!K()>1WT)'[EMAIL PROTECTED](!O'`H9T'!N-5KI(*<J^S7'[EMAIL PROTECTED]&2QQ)W.9]O\<JCW M;5,644;[B0N.*1>DN4+,#:"RC;2:[EMAIL PROTECTED]&)5I&D\#S9+$/5?#WZ`-SN? MC4;[EMAIL PROTECTED]/[EMAIL PROTECTED]/Q>S^;D?AU!M.6;C[83C_D=O,AM, M?\_8\NRF3,>>C-Y>ZU^.A]ZG^?GQ\'1[N6[Y2_9.VJ>3CY/YX&+F32Z.ASNT M+F>C"^]LWA],C]\-O6T7W0$X'4;E>*2YPAN.<S-TK19?Z^W=8'#3UANI]#UV M`&>GX_E[[.D-]W%B40A[KW:B]^$']EB'J+&]VE%':9DHRBR!EG<Q^N!].*R' M>-5T:>:]U<8VG^C3Q/_:Z('!X3,)#%Q":Q4^H\A66Q2D:TA!*B.Y[9`KL\4^ M5-4]X^*F6<(<\X4M+=52&JT94#X/K1*/*]P[*H-L%62K]\)5[XDRFA9A&+EQ M'=LR#2;C'4?YG;MXSB261F*5S\T&J_J\J<]=A5V%.9%R4D9B0V&CP:["3;PZ MJI21V%38;+"M\%T_KLX:97!^W+1?LID#;ILOR;O_IL)/A&"=EYL>\<W0"?U` *_P>X5)`VSPD````` ` end ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel