Need Help:: BCE Interface - back port SERDES support to STABLE

From: Conrad Burger <conrad.burger_at_mxit.com>
Date: Wed, 31 Jan 2007 15:00:34 +0200
*******************************************************************
Click here to view our e-mail legal notice: 
http://www.mxit.co.za/pdfs/mxit_legal.pdf or call: +27 21 888 5000
*******************************************************************
Hi 

Could someone please help me to create a patch to back port the SERDES support
that was recently added to the BCE driver in CURRENT to STABLE?

I have been waiting for SERDES support on STABLE for about 3 months and I'm
getting rather desperate.

I am trying to back port it myself using diffs from BCE-STABLE and BCE-CURRENT. 
But with almost no C experience and even less writing drivers it's going to take
awhile.
Currently my kernel panics during boot when it tries to attach/probe the network
interface. 

I would be much appreciated it if someone could help me.

Regards 
Conrad 

My latest try.

*** if_bce.c-v1.27      Wed Jan 31 15:02:26 2007
--- if_bce.c-conrad-mod Wed Jan 31 13:18:00 2007
***************
*** 452,458 ****
        struct bce_softc *sc;
        struct ifnet *ifp;
        u32 val;
!       int count, mbuf, rid, rc = 0;

        sc = device_get_softc(dev);
        sc->bce_dev = dev;
--- 452,459 ----
        struct bce_softc *sc;
        struct ifnet *ifp;
        u32 val;
!       //#!# int count, mbuf, rid, rc = 0;
!       int mbuf, rid, rc = 0;

        sc = device_get_softc(dev);
        sc->bce_dev = dev;
***************
*** 485,496 ****
        sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);

        /* Allocate PCI IRQ resources. */
!       count = pci_msi_count(dev);
        if (count == 1 && pci_alloc_msi(dev, &count) == 0) {
                rid = 1;
                sc->bce_flags |= BCE_USING_MSI_FLAG;
        } else
!               rid = 0;
        sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
            RF_SHAREABLE | RF_ACTIVE);

--- 486,498 ----
        sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);

        /* Allocate PCI IRQ resources. */
! /*#!# count = pci_msi_count(dev);
        if (count == 1 && pci_alloc_msi(dev, &count) == 0) {
                rid = 1;
                sc->bce_flags |= BCE_USING_MSI_FLAG;
        } else
! */            rid = 0;
!
        sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
            RF_SHAREABLE | RF_ACTIVE);

***************
*** 2525,2535 ****
        if (sc->bce_irq != NULL)
                bus_release_resource(dev,
                        SYS_RES_IRQ,
!                       sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0,
                        sc->bce_irq);

!       if (sc->bce_flags & BCE_USING_MSI_FLAG)
                pci_release_msi(dev);

        if (sc->bce_res != NULL)
                bus_release_resource(dev,
--- 2527,2539 ----
        if (sc->bce_irq != NULL)
                bus_release_resource(dev,
                        SYS_RES_IRQ,
!                       //sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0,
!                       0,
                        sc->bce_irq);

!       /* #!#if (sc->bce_flags & BCE_USING_MSI_FLAG)
                pci_release_msi(dev);
+       */

        if (sc->bce_res != NULL)
                bus_release_resource(dev,
***************
*** 4129,4136 ****
  #if __FreeBSD_version < 700000
                                VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag,
continue);
  #else
!                               m->m_pkthdr.ether_vtag =
l2fhdr->l2_fhdr_vlan_tag;
!                               m->m_flags |= M_VLANTAG;
  #endif
                        }

--- 4133,4144 ----
  #if __FreeBSD_version < 700000
                                VLAN_INPUT_TAG(ifp, m, l2fhdr->l2_fhdr_vlan_tag,
continue);
  #else
! // #!#                                m->m_pkthdr.ether_vtag =
l2fhdr->l2_fhdr_vlan_tag;
! // #!#                                m->m_flags |= M_VLANTAG;
!                               VLAN_INPUT_TAG(ifp, m,
l2fhdr->l2_fhdr_vlan_tag);
!                               if (m == NULL)
!                                       continue;
!
  #endif
                        }

***************
*** 4515,4520 ****
--- 4523,4530 ----
        bus_dma_segment_t segs[BCE_MAX_SEGMENTS];
        bus_dmamap_t map;
        struct tx_bd *txbd = NULL;
+       //#!#
+       struct m_tag *mtag;
        struct mbuf *m0;
        u16 vlan_tag = 0, flags = 0;
        u16 chain_prod, prod;
***************
*** 4535,4544 ****
        }

        /* Transfer any VLAN tags to the bd. */
!       if (m0->m_flags & M_VLANTAG) {
                flags |= TX_BD_FLAGS_VLAN_TAG;
                vlan_tag = m0->m_pkthdr.ether_vtag;
        }

        /* Map the mbuf into DMAable memory. */
        prod = sc->tx_prod;
--- 4545,4560 ----
        }

        /* Transfer any VLAN tags to the bd. */
! /* #!#        if (m0->m_flags & M_VLANTAG) {
                flags |= TX_BD_FLAGS_VLAN_TAG;
                vlan_tag = m0->m_pkthdr.ether_vtag;
                }
+ */
+       mtag = VLAN_OUTPUT_TAG(sc->bce_ifp, m0);
+       if (mtag != NULL) {
+               flags |= TX_BD_FLAGS_VLAN_TAG;
+               vlan_tag = VLAN_TAG_VALUE(mtag);
+       }

        /* Map the mbuf into DMAable memory. */
        prod = sc->tx_prod;
Received on Wed Jan 31 2007 - 15:25:08 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:05 UTC