Author: yongari
Date: Tue Nov  2 23:07:38 2010
New Revision: 214701
URL: http://svn.freebsd.org/changeset/base/214701

Log:
  MFC r213316,213333-213334:
  r213316:
    Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used
    IFCAP_HWCSUM to know which capability should be changed such that
    disabling RX checksun offloading resulted in disabling TX checksum
    offloading.
  
  r213333:
    Allow write DMA to request larger DMA burst size to get better
    performance on BCM5785.
  
    Obtained from:      OpenBSD
  
  r213334:
    Remove extra semicolon.

Modified:
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c       Tue Nov  2 23:04:23 2010        
(r214700)
+++ stable/7/sys/dev/bge/if_bge.c       Tue Nov  2 23:07:38 2010        
(r214701)
@@ -1052,7 +1052,7 @@ bge_init_rx_ring_std(struct bge_softc *s
                if ((error = bge_newbuf_std(sc, i)) != 0)
                        return (error);
                BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT);
-       };
+       }
 
        bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
            sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE);
@@ -1095,7 +1095,7 @@ bge_init_rx_ring_jumbo(struct bge_softc 
                if ((error = bge_newbuf_jumbo(sc, i)) != 0)
                        return (error);
                BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT);
-       };
+       }
 
        bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
            sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE);
@@ -1834,6 +1834,10 @@ bge_blockinit(struct bge_softc *sc)
        if (BGE_IS_5755_PLUS(sc))
                val |= BGE_WDMAMODE_STATUS_TAG_FIX;
 
+       /* Request larger DMA burst size to get better performance. */
+       if (sc->bge_asicrev == BGE_ASICREV_BCM5785)
+               val |= BGE_WDMAMODE_BURST_ALL_DATA;
+
        /* Turn on write DMA state machine */
        CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
        DELAY(40);
@@ -4628,15 +4632,19 @@ bge_ioctl(struct ifnet *ifp, u_long comm
                        }
                }
 #endif
-               if (mask & IFCAP_HWCSUM) {
-                       ifp->if_capenable ^= IFCAP_HWCSUM;
-                       if (IFCAP_HWCSUM & ifp->if_capenable &&
-                           IFCAP_HWCSUM & ifp->if_capabilities)
+               if ((mask & IFCAP_TXCSUM) != 0 &&
+                   (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
+                       ifp->if_capenable ^= IFCAP_TXCSUM;
+                       if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
                                ifp->if_hwassist |= sc->bge_csum_features;
                        else
                                ifp->if_hwassist &= ~sc->bge_csum_features;
                }
 
+               if ((mask & IFCAP_RXCSUM) != 0 &&
+                   (ifp->if_capabilities & IFCAP_RXCSUM) != 0)
+                       ifp->if_capenable ^= IFCAP_RXCSUM;
+
                if ((mask & IFCAP_TSO4) != 0 &&
                    (ifp->if_capabilities & IFCAP_TSO4) != 0) {
                        ifp->if_capenable ^= IFCAP_TSO4;

Modified: stable/7/sys/dev/bge/if_bgereg.h
==============================================================================
--- stable/7/sys/dev/bge/if_bgereg.h    Tue Nov  2 23:04:23 2010        
(r214700)
+++ stable/7/sys/dev/bge/if_bgereg.h    Tue Nov  2 23:07:38 2010        
(r214701)
@@ -1481,6 +1481,7 @@
 #define        BGE_WDMAMODE_LOCREAD_TOOBIG     0x00000200
 #define        BGE_WDMAMODE_ALL_ATTNS          0x000003FC
 #define        BGE_WDMAMODE_STATUS_TAG_FIX     0x20000000
+#define        BGE_WDMAMODE_BURST_ALL_DATA     0xC0000000
 
 /* Write DMA status register */
 #define        BGE_WDMASTAT_PCI_TGT_ABRT_ATTN  0x00000004
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to