[rfc] MFC 7.x bce(4) to 6.x

pluknet pluknet at gmail.com
Fri Jul 17 13:46:17 UTC 2009


2009/7/17 pluknet <pluknet at gmail.com>:
> Hi.
>
> Is there a planned MFC of bce(4) changes between 6.4 and 7.2 to RELENG_6?
>
> We need this at work in order to support Broadcom BCM5709 in (post-)6.4.
>
> I could able to backport recent 7.x changes to 6.4.
> I'm not sure about MSI and/or TSO4 stability here since there are
> changes since 6.x in bce(4).
> What I did is checkout RELENG_7 bce sources plus small hackish patch
> to compile this on 6.x.
>
> # uname -a
> FreeBSD  6.4-RELEASE FreeBSD 6.4-RELEASE #0: Fri Jul 17 21:08:32 MSD
> 2009     root@:/usr/obj/usr/src/sys/SMP  i386
>
> It seems to work good. I have a network access to the box now.
>
> after kldload if_bce:
> bce0: <Broadcom NetXtreme II BCM5709 1000Base-T (C0)> mem 0x92000000-0x93ffffff
> irq 28 at device 0.0 on pci11
> miibus0: <MII bus> on bce0
> ukphy0: <Generic IEEE 802.3u media interface> on miibus0
> ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FD
> X, auto
> bce0: Ethernet address: 00:1a:64:e5:13:ec
> bce0: link state changed to DOWN
> bce0: ASIC (0x57092003); Rev (C0); Bus (PCIe x2, 5Gbps); B/C (0x04060705); Flags
> ( MFW MSI )
> bce1: <Broadcom NetXtreme II BCM5709 1000Base-T (C0)> mem 0x94000000-0x95ffffff
> irq 40 at device 0.1 on pci11
> miibus1: <MII bus> on bce1
> ukphy1: <Generic IEEE 802.3u media interface> on miibus1
> ukphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FD
> X, auto
> bce1: Ethernet address: 00:1a:64:e5:13:ee
> bce1: ASIC (0x
> bce1: link state changed to DOWN
> 57092003); Rev (C0); Bus (PCIe x2, 5Gbps); B/C (0x04060705); Flags( MFW MSI )
> bce0: link state changed to UP
> bce0: link state changed to DOWN
> bce0: link state changed to UP

Ah, yes. Forgot to show dmesg from 7.2 for comparison:
bce0: <Broadcom NetXtreme II BCM5709 1000Base-T (C0)> mem
0x92000000-0x93ffffff irq 28 at device 0.0 on pci11
bce0: Reserved 0x2000000 bytes for rid 0x10 type 3 at 0x92000000
bce0: attempting to allocate 1 MSI vectors (16 supported)
bce0: using IRQ 256 for MSI
miibus0: <MII bus> on bce0
bce0: bpf attached
bce0: Ethernet address: 00:1a:64:e5:13:ec
bce0: [MPSAFE]
bce0: [ITHREAD]
bce0: ASIC (0x57092003); Rev (C0); Bus (PCIe x2, 5Gbps); B/C
(0x04060705); Flags( MFW MSI )
bce1: <Broadcom NetXtreme II BCM5709 1000Base-T (C0)> mem
0x94000000-0x95ffffff irq 40 at device 0.1 on pci11
bce1: Reserved 0x2000000 bytes for rid 0x10 type 3 at 0x94000000
bce1: attempting to allocate 1 MSI vectors (16 supported)
bce1: using IRQ 257 for MSI
miibus1: <MII bus> on bce1
bce1: bpf attached
bce1: Ethernet address: 00:1a:64:e5:13:ee
bce1: [MPSAFE]
bce1: [ITHREAD]
bce1: ASIC (0x57092003); Rev (C0); Bus (PCIe x2, 5Gbps); B/C
(0x04060705); Flags( MFW MSI )
bce0: link state changed to UP


>
> The patch (against if_bce.c,v 1.34.2.9):
>
> --- /home/pluknet/cvs-7/src/sys/dev/bce/if_bce.c        Wed Jun  3 13:42:55 2009
> +++ bce/if_bce.c        Fri Jul 17 15:26:00 2009
> @@ -54,6 +54,12 @@ __FBSDID("$FreeBSD: src/sys/dev/bce/if_b
>  #include <dev/bce/if_bcereg.h>
>  #include <dev/bce/if_bcefw.h>
>
> +/* From sys/mbuf.h */
> +#define CSUM_TSO       0x0020          /* will do TSO */
> +
> +/* From net/if.h */
> +#define IFCAP_TSO4     0x00100         /* can do TCP Segmentation Offload */
> +
>  /****************************************************************************/
>  /* BCE Debug Options                                                        */
>  /****************************************************************************/
> @@ -1059,7 +1065,7 @@ bce_attach(device_t dev)
>
>        /* Hookup IRQ last. */
>        rc = bus_setup_intr(dev, sc->bce_res_irq, INTR_TYPE_NET | INTR_MPSAFE,
> -               NULL, bce_intr, sc, &sc->bce_intrhand);
> +               bce_intr, sc, &sc->bce_intrhand);
>
>        if (rc) {
>                BCE_PRINTF("%s(%d): Failed to setup IRQ!\n",
> @@ -6391,13 +6397,24 @@ bce_tx_encap(struct bce_softc *sc, struc
>        bus_dma_segment_t segs[BCE_MAX_SEGMENTS];
>        bus_dmamap_t map;
>        struct tx_bd *txbd = NULL;
> +#if __FreeBSD_version <= 700022
> +       struct m_tag *mtag;
> +#endif
>        struct mbuf *m0;
> +#if __FreeBSD_version > 700022
>        struct ether_vlan_header *eh;
>        struct ip *ip;
>        struct tcphdr *th;
> -       u16 prod, chain_prod, etype, mss = 0, vlan_tag = 0, flags = 0;
> +#endif
> +       u16 prod, chain_prod,
> +#if __FreeBSD_version > 700022
> +       etype,
> +#endif
> +       mss = 0, vlan_tag = 0, flags = 0;
>        u32 prod_bseq;
> +#if __FreeBSD_version > 700022
>        int hdr_len = 0, e_hlen = 0, ip_hlen = 0, tcp_hlen = 0, ip_len = 0;
> +#endif
>
>  #ifdef BCE_DEBUG
>        u16 debug_prod;
> @@ -6418,6 +6435,7 @@ bce_tx_encap(struct bce_softc *sc, struc
>                        flags |= TX_BD_FLAGS_IP_CKSUM;
>                if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))
>                        flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
> +#if __FreeBSD_version > 700022
>                if (m0->m_pkthdr.csum_flags & CSUM_TSO) {
>                        /* For TSO the controller needs two pieces of info, */
>                        /* the MSS and the IP+TCP options length.           */
> @@ -6481,14 +6499,23 @@ bce_tx_encap(struct bce_softc *sc, struc
>  bce_tx_encap_skip_tso:
>                        DBRUN(sc->requested_tso_frames++);
>                }
> +#endif
>        }
>
>        /* Transfer any VLAN tags to the bd. */
> +#if __FreeBSD_version > 700022
>        if (m0->m_flags & M_VLANTAG) {
>                flags |= TX_BD_FLAGS_VLAN_TAG;
>                vlan_tag = m0->m_pkthdr.ether_vtag;
>        }
>
> +#else
> +        mtag = VLAN_OUTPUT_TAG(sc->bce_ifp, m0);
> +        if (mtag != NULL) {
> +                flags |= TX_BD_FLAGS_VLAN_TAG;
> +                vlan_tag = VLAN_TAG_VALUE(mtag);
> +        }
> +#endif
>        /* Map the mbuf into DMAable memory. */
>        prod = sc->tx_prod;
>        chain_prod = TX_CHAIN_IDX(prod);
>
> --
> wbr,
> pluknet
>



-- 
wbr,
pluknet


More information about the freebsd-stable mailing list