Looking for some testing of the following diff to add Jumbo support for the
BCM5714 / BCM5780 and BCM5717 / BCM5719 / BCM5720 / BCM57765 / BCM57766
chipsets.


Index: if_bge.c
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.360
diff -u -p -u -p -r1.360 if_bge.c
--- if_bge.c    26 Aug 2014 11:01:21 -0000      1.360
+++ if_bge.c    27 Aug 2014 00:48:45 -0000
@@ -1117,10 +1117,10 @@ bge_newbuf(struct bge_softc *sc, int i)
        struct mbuf             *m;
        int                     error;
 
-       m = MCLGETI(NULL, M_DONTWAIT, NULL, MCLBYTES);
+       m = MCLGETI(NULL, M_DONTWAIT, NULL, sc->bge_rx_std_len);
        if (!m)
                return (ENOBUFS);
-       m->m_len = m->m_pkthdr.len = MCLBYTES;
+       m->m_len = m->m_pkthdr.len = sc->bge_rx_std_len;
        if (!(sc->bge_flags & BGE_RX_ALIGNBUG))
            m_adj(m, ETHER_ALIGN);
 
@@ -1241,8 +1241,8 @@ bge_init_rx_ring_std(struct bge_softc *s
                return (0);
 
        for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
-               if (bus_dmamap_create(sc->bge_dmatag, MCLBYTES, 1, MCLBYTES, 0,
-                   BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
+               if (bus_dmamap_create(sc->bge_dmatag, sc->bge_rx_std_len, 1,
+                   sc->bge_rx_std_len, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
                    &sc->bge_cdata.bge_rx_std_map[i]) != 0) {
                        printf("%s: unable to create dmamap for slot %d\n",
                            sc->bge_dev.dv_xname, i);
@@ -1485,6 +1485,7 @@ bge_init_tx_ring(struct bge_softc *sc)
 {
        int i;
        bus_dmamap_t dmamap;
+       bus_size_t txsegsz, txmaxsegsz;
        struct txdmamap_pool_entry *dma;
 
        if (sc->bge_flags & BGE_TXRING_VALID)
@@ -1504,11 +1505,18 @@ bge_init_tx_ring(struct bge_softc *sc)
        if (BGE_CHIPREV(sc->bge_chipid) == BGE_CHIPREV_5700_BX)
                bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
 
+       if (BGE_IS_JUMBO_CAPABLE(sc)) {
+               txsegsz = 4096;
+               txmaxsegsz = BGE_JLEN;
+       } else {
+               txsegsz = MCLBYTES;
+               txmaxsegsz = MCLBYTES;
+       }
+
        SLIST_INIT(&sc->txdma_list);
        for (i = 0; i < BGE_TX_RING_CNT; i++) {
-               if (bus_dmamap_create(sc->bge_dmatag, BGE_JLEN,
-                   BGE_NTXSEG, BGE_JLEN, 0, BUS_DMA_NOWAIT,
-                   &dmamap))
+               if (bus_dmamap_create(sc->bge_dmatag, txmaxsegsz,
+                   BGE_NTXSEG, txsegsz, 0, BUS_DMA_NOWAIT, &dmamap))
                        return (ENOBUFS);
                if (dmamap == NULL)
                        panic("dmamap NULL in bge_init_tx_ring");
@@ -2001,7 +2009,7 @@ bge_blockinit(struct bge_softc *sc)
         * using this ring (i.e. once we set the MTU
         * high enough to require it).
         */
-       if (BGE_IS_JUMBO_CAPABLE(sc)) {
+       if (sc->bge_flags & BGE_JUMBO_RING) {
                rcb = &sc->bge_rdata->bge_info.bge_jumbo_rx_rcb;
                BGE_HOSTADDR(rcb->bge_hostaddr,
                    BGE_RING_DMA_ADDR(sc, bge_rx_jumbo_ring));
@@ -2065,7 +2073,7 @@ bge_blockinit(struct bge_softc *sc)
         * to work around HW bugs.
         */
        CSR_WRITE_4(sc, BGE_RBDI_STD_REPL_THRESH, 8);
-       if (BGE_IS_JUMBO_CAPABLE(sc))
+       if (sc->bge_flags & BGE_JUMBO_RING)
                CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, 8);
 
        if (BGE_IS_5717_PLUS(sc)) {
@@ -2699,7 +2707,8 @@ bge_attach(struct device *parent, struct
        case BGE_ASICREV_BCM5719:
        case BGE_ASICREV_BCM5720:
                sc->bge_flags |= BGE_5717_PLUS | BGE_5755_PLUS | BGE_575X_PLUS |
-                   BGE_5705_PLUS;
+                   BGE_5705_PLUS | BGE_JUMBO_CAPABLE | BGE_JUMBO_RING |
+                   BGE_JUMBO_FRAME;
                if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5719 ||
                    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5720) {
                        /*
@@ -2707,6 +2716,13 @@ bge_attach(struct device *parent, struct
                         * of TXMBUF available space.
                         */
                        sc->bge_flags |= BGE_RDMA_BUG;
+
+                       if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5719 
&&
+                           sc->bge_chipid == BGE_CHIPID_BCM5719_A0) {
+                               /* Jumbo frame on BCM5719 A0 does not work. */
+                               sc->bge_flags &= ~(BGE_JUMBO_CAPABLE |
+                                   BGE_JUMBO_RING | BGE_JUMBO_FRAME);
+                       }
                }
                break;
        case BGE_ASICREV_BCM5755:
@@ -2721,12 +2737,12 @@ bge_attach(struct device *parent, struct
        case BGE_ASICREV_BCM5701:
        case BGE_ASICREV_BCM5703:
        case BGE_ASICREV_BCM5704:
-               sc->bge_flags |= BGE_5700_FAMILY | BGE_JUMBO_CAPABLE;
+               sc->bge_flags |= BGE_5700_FAMILY | BGE_JUMBO_CAPABLE | 
BGE_JUMBO_RING;
                break;
        case BGE_ASICREV_BCM5714_A0:
        case BGE_ASICREV_BCM5780:
        case BGE_ASICREV_BCM5714:
-               sc->bge_flags |= BGE_5714_FAMILY;
+               sc->bge_flags |= BGE_5714_FAMILY | BGE_JUMBO_CAPABLE | 
BGE_JUMBO_STD;
                /* FALLTHROUGH */
        case BGE_ASICREV_BCM5750:
        case BGE_ASICREV_BCM5752:
@@ -2738,6 +2754,11 @@ bge_attach(struct device *parent, struct
                break;
        }
 
+       if (sc->bge_flags & BGE_JUMBO_STD)
+               sc->bge_rx_std_len = BGE_JLEN;
+       else
+               sc->bge_rx_std_len = MCLBYTES;
+
        /*
         * When using the BCM5701 in PCI-X mode, data corruption has
         * been observed in the first few bytes of some received packets.
@@ -4003,6 +4024,10 @@ bge_encap(struct bge_softc *sc, struct m
                }
        }
 
+       if (sc->bge_flags & BGE_JUMBO_FRAME && 
+           m_head->m_pkthdr.len > ETHER_MAX_LEN)
+               csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME;
+
        if (!(BGE_CHIPREV(sc->bge_chipid) == BGE_CHIPREV_5700_BX))
                goto doit;
 
@@ -4232,7 +4257,7 @@ bge_init(void *xsc)
        }
 
        /* Init Jumbo RX ring. */
-       if (BGE_IS_JUMBO_CAPABLE(sc))
+       if (sc->bge_flags & BGE_JUMBO_RING)
                bge_init_rx_ring_jumbo(sc);
 
        /* Init our RX return ring index */
@@ -4635,7 +4660,7 @@ bge_stop(struct bge_softc *sc)
        bge_free_rx_ring_std(sc);
 
        /* Free jumbo RX list. */
-       if (BGE_IS_JUMBO_CAPABLE(sc))
+       if (sc->bge_flags & BGE_JUMBO_RING)
                bge_free_rx_ring_jumbo(sc);
 
        /* Free TX buffers. */
Index: if_bgereg.h
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_bgereg.h,v
retrieving revision 1.125
diff -u -p -u -p -r1.125 if_bgereg.h
--- if_bgereg.h 24 Aug 2014 05:01:42 -0000      1.125
+++ if_bgereg.h 24 Aug 2014 05:02:27 -0000
@@ -2880,6 +2880,9 @@ struct bge_softc {
 #define        BGE_TAGGED_STATUS       0x00200000
 #define        BGE_MSI                 0x00400000
 #define        BGE_RDMA_BUG            0x00800000
+#define        BGE_JUMBO_RING          0x01000000
+#define        BGE_JUMBO_STD           0x02000000
+#define        BGE_JUMBO_FRAME         0x04000000
 
        u_int32_t               bge_phy_flags;
 #define        BGE_PHY_NO_3LED         0x00000001
@@ -2911,6 +2914,7 @@ struct bge_softc {
        u_int32_t               bge_tx_prodidx;
        struct if_rxring        bge_std_ring;
        u_int16_t               bge_std;        /* current std ring head */
+       int                     bge_rx_std_len;
        struct if_rxring        bge_jumbo_ring;
        u_int16_t               bge_jumbo;      /* current jumo ring head */
        u_int32_t               bge_stat_ticks;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to