Date: Fri, 17 Jul 2009 17:46:14 +0400 From: pluknet <pluknet@gmail.com> To: freebsd-stable <freebsd-stable@freebsd.org>, Xin LI <delphij@delphij.net> Subject: Re: [rfc] MFC 7.x bce(4) to 6.x Message-ID: <a31046fc0907170646r1789f3abva2b5676fa95771d5@mail.gmail.com> In-Reply-To: <a31046fc0907170642s67281e43mf14532105b8fbedf@mail.gmail.com> References: <a31046fc0907170642s67281e43mf14532105b8fbedf@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/7/17 pluknet <pluknet@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 =A06.4-RELEASE FreeBSD 6.4-RELEASE #0: Fri Jul 17 21:08:32 MSD > 2009 =A0 =A0 root@:/usr/obj/usr/src/sys/SMP =A0i386 > > 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-0x93= ffffff > irq 28 at device 0.0 on pci11 > miibus0: <MII bus> on bce0 > ukphy0: <Generic IEEE 802.3u media interface> on miibus0 > ukphy0: =A010baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 100= 0baseT-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-0x95= ffffff > irq 40 at device 0.1 on pci11 > miibus1: <MII bus> on bce1 > ukphy1: <Generic IEEE 802.3u media interface> on miibus1 > ukphy1: =A010baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 100= 0baseT-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 M= SI ) > 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 =A0 =A0 =A0 =A0Wed Jun = =A03 13:42:55 2009 > +++ bce/if_bce.c =A0 =A0 =A0 =A0Fri Jul 17 15:26:00 2009 > @@ -54,6 +54,12 @@ __FBSDID("$FreeBSD: src/sys/dev/bce/if_b > =A0#include <dev/bce/if_bcereg.h> > =A0#include <dev/bce/if_bcefw.h> > > +/* From sys/mbuf.h */ > +#define CSUM_TSO =A0 =A0 =A0 0x0020 =A0 =A0 =A0 =A0 =A0/* will do TSO */ > + > +/* From net/if.h */ > +#define IFCAP_TSO4 =A0 =A0 0x00100 =A0 =A0 =A0 =A0 /* can do TCP Segment= ation Offload */ > + > =A0/*********************************************************************= *******/ > =A0/* BCE Debug Options =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > =A0/*********************************************************************= *******/ > @@ -1059,7 +1065,7 @@ bce_attach(device_t dev) > > =A0 =A0 =A0 =A0/* Hookup IRQ last. */ > =A0 =A0 =A0 =A0rc =3D bus_setup_intr(dev, sc->bce_res_irq, INTR_TYPE_NET = | INTR_MPSAFE, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, bce_intr, sc, &sc->bce_intrhand); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bce_intr, sc, &sc->bce_intrhand); > > =A0 =A0 =A0 =A0if (rc) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BCE_PRINTF("%s(%d): Failed to setup IRQ!\n= ", > @@ -6391,13 +6397,24 @@ bce_tx_encap(struct bce_softc *sc, struc > =A0 =A0 =A0 =A0bus_dma_segment_t segs[BCE_MAX_SEGMENTS]; > =A0 =A0 =A0 =A0bus_dmamap_t map; > =A0 =A0 =A0 =A0struct tx_bd *txbd =3D NULL; > +#if __FreeBSD_version <=3D 700022 > + =A0 =A0 =A0 struct m_tag *mtag; > +#endif > =A0 =A0 =A0 =A0struct mbuf *m0; > +#if __FreeBSD_version > 700022 > =A0 =A0 =A0 =A0struct ether_vlan_header *eh; > =A0 =A0 =A0 =A0struct ip *ip; > =A0 =A0 =A0 =A0struct tcphdr *th; > - =A0 =A0 =A0 u16 prod, chain_prod, etype, mss =3D 0, vlan_tag =3D 0, fla= gs =3D 0; > +#endif > + =A0 =A0 =A0 u16 prod, chain_prod, > +#if __FreeBSD_version > 700022 > + =A0 =A0 =A0 etype, > +#endif > + =A0 =A0 =A0 mss =3D 0, vlan_tag =3D 0, flags =3D 0; > =A0 =A0 =A0 =A0u32 prod_bseq; > +#if __FreeBSD_version > 700022 > =A0 =A0 =A0 =A0int hdr_len =3D 0, e_hlen =3D 0, ip_hlen =3D 0, tcp_hlen = =3D 0, ip_len =3D 0; > +#endif > > =A0#ifdef BCE_DEBUG > =A0 =A0 =A0 =A0u16 debug_prod; > @@ -6418,6 +6435,7 @@ bce_tx_encap(struct bce_softc *sc, struc > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags |=3D TX_BD_FLAGS_IP_= CKSUM; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (m0->m_pkthdr.csum_flags & (CSUM_TCP | = CSUM_UDP)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags |=3D TX_BD_FLAGS_TCP= _UDP_CKSUM; > +#if __FreeBSD_version > 700022 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (m0->m_pkthdr.csum_flags & CSUM_TSO) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* For TSO the controller = needs two pieces of info, */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* the MSS and the IP+TCP = options length. =A0 =A0 =A0 =A0 =A0 */ > @@ -6481,14 +6499,23 @@ bce_tx_encap(struct bce_softc *sc, struc > =A0bce_tx_encap_skip_tso: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DBRUN(sc->requested_tso_fr= ames++); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > +#endif > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0/* Transfer any VLAN tags to the bd. */ > +#if __FreeBSD_version > 700022 > =A0 =A0 =A0 =A0if (m0->m_flags & M_VLANTAG) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags |=3D TX_BD_FLAGS_VLAN_TAG; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vlan_tag =3D m0->m_pkthdr.ether_vtag; > =A0 =A0 =A0 =A0} > > +#else > + =A0 =A0 =A0 =A0mtag =3D VLAN_OUTPUT_TAG(sc->bce_ifp, m0); > + =A0 =A0 =A0 =A0if (mtag !=3D NULL) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags |=3D TX_BD_FLAGS_VLAN_TAG; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vlan_tag =3D VLAN_TAG_VALUE(mtag); > + =A0 =A0 =A0 =A0} > +#endif > =A0 =A0 =A0 =A0/* Map the mbuf into DMAable memory. */ > =A0 =A0 =A0 =A0prod =3D sc->tx_prod; > =A0 =A0 =A0 =A0chain_prod =3D TX_CHAIN_IDX(prod); > > -- > wbr, > pluknet > --=20 wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0907170646r1789f3abva2b5676fa95771d5>