[BACK]Return to if_bge.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / pci

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/pci/if_bge.c between version 1.145.10.5 and 1.145.10.6

version 1.145.10.5, 2010/03/11 15:03:44 version 1.145.10.6, 2010/08/11 22:53:45
Line 150  __KERNEL_RCSID(0, "$NetBSD$");
Line 150  __KERNEL_RCSID(0, "$NetBSD$");
  * such that moving from one pair to the succeeding pair was observed   * such that moving from one pair to the succeeding pair was observed
  * to roughly halve interrupt rate under sustained input packet load.   * to roughly halve interrupt rate under sustained input packet load.
  * The values were empirically chosen to avoid overflowing internal   * The values were empirically chosen to avoid overflowing internal
  * limits on the  bcm5700: inreasing rx_ticks much beyond 600   * limits on the  bcm5700: increasing rx_ticks much beyond 600
  * results in internal wrapping and higher interrupt rates.   * results in internal wrapping and higher interrupt rates.
  * The limit of 46 frames was chosen to match NFS workloads.   * The limit of 46 frames was chosen to match NFS workloads.
  *   *
Line 208  static int bge_encap(struct bge_softc *,
Line 208  static int bge_encap(struct bge_softc *,
   
 static int bge_intr(void *);  static int bge_intr(void *);
 static void bge_start(struct ifnet *);  static void bge_start(struct ifnet *);
   static int bge_ifflags_cb(struct ethercom *);
 static int bge_ioctl(struct ifnet *, u_long, void *);  static int bge_ioctl(struct ifnet *, u_long, void *);
 static int bge_init(struct ifnet *);  static int bge_init(struct ifnet *);
 static void bge_stop(struct ifnet *, int);  static void bge_stop(struct ifnet *, int);
Line 757  bge_set_max_readrq(struct bge_softc *sc)
Line 758  bge_set_max_readrq(struct bge_softc *sc)
             + PCI_PCIE_DCSR);              + PCI_PCIE_DCSR);
         if ((val & PCI_PCIE_DCSR_MAX_READ_REQ) !=          if ((val & PCI_PCIE_DCSR_MAX_READ_REQ) !=
             BGE_PCIE_DEVCTL_MAX_READRQ_4096) {              BGE_PCIE_DEVCTL_MAX_READRQ_4096) {
                         printf("adjust device control 0x%04x ",                  aprint_verbose("adjust device control 0x%04x ", val);
                             val);  
                 val &= ~PCI_PCIE_DCSR_MAX_READ_REQ;                  val &= ~PCI_PCIE_DCSR_MAX_READ_REQ;
                 val |= BGE_PCIE_DEVCTL_MAX_READRQ_4096;                  val |= BGE_PCIE_DEVCTL_MAX_READRQ_4096;
                 pci_conf_write(sc->sc_pc, sc->sc_pcitag, sc->bge_pciecap                  pci_conf_write(sc->sc_pc, sc->sc_pcitag, sc->bge_pciecap
                     + PCI_PCIE_DCSR, val);                      + PCI_PCIE_DCSR, val);
                         printf("-> 0x%04x\n", val);                  aprint_verbose("-> 0x%04x\n", val);
         }          }
 }  }
   
Line 1301  bge_jfree(struct mbuf *m, void *buf, siz
Line 1301  bge_jfree(struct mbuf *m, void *buf, siz
   
   
 /*  /*
  * Intialize a standard receive ring descriptor.   * Initialize a standard receive ring descriptor.
  */   */
 static int  static int
 bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m,  bge_newbuf_std(struct bge_softc *sc, int i, struct mbuf *m,
Line 1843  bge_chipinit(struct bge_softc *sc)
Line 1843  bge_chipinit(struct bge_softc *sc)
                 /* Conventional PCI bus: 256 bytes for read and write. */                  /* Conventional PCI bus: 256 bytes for read and write. */
                 DPRINTFN(4, ("(%s: PCI 2.2 DMA setting)\n",                  DPRINTFN(4, ("(%s: PCI 2.2 DMA setting)\n",
                     device_xname(sc->bge_dev)));                      device_xname(sc->bge_dev)));
                 dma_rw_ctl = (0x7 << BGE_PCIDMARWCTL_RD_WAT_SHIFT) |                  dma_rw_ctl |= (0x7 << BGE_PCIDMARWCTL_RD_WAT_SHIFT) |
                    (0x7 << BGE_PCIDMARWCTL_WR_WAT_SHIFT);                     (0x7 << BGE_PCIDMARWCTL_WR_WAT_SHIFT);
                 if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5705 &&                  if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5705 &&
                     BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5750)                      BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5750)
Line 2450  bge_setpowerstate(struct bge_softc *sc, 
Line 2450  bge_setpowerstate(struct bge_softc *sc, 
         /*          /*
          * Entering ACPI power states D1-D3 is achieved by wiggling           * Entering ACPI power states D1-D3 is achieved by wiggling
          * GMII gpio pins. Example code assumes all hardware vendors           * GMII gpio pins. Example code assumes all hardware vendors
          * followed Broadom's sample pcb layout. Until we verify that           * followed Broadcom's sample pcb layout. Until we verify that
          * for all supported OEM cards, states D1-D3 are  unsupported.           * for all supported OEM cards, states D1-D3 are  unsupported.
          */           */
         aprint_error_dev(sc->bge_dev,          aprint_error_dev(sc->bge_dev,
Line 3015  bge_attach(device_t parent, device_t sel
Line 3015  bge_attach(device_t parent, device_t sel
         if_attach(ifp);          if_attach(ifp);
         DPRINTFN(5, ("ether_ifattach\n"));          DPRINTFN(5, ("ether_ifattach\n"));
         ether_ifattach(ifp, eaddr);          ether_ifattach(ifp, eaddr);
           ether_set_ifflags_cb(&sc->ethercom, bge_ifflags_cb);
 #if NRND > 0  #if NRND > 0
         rnd_attach_source(&sc->rnd_source, device_xname(sc->bge_dev),          rnd_attach_source(&sc->rnd_source, device_xname(sc->bge_dev),
                 RND_TYPE_NET, 0);                  RND_TYPE_NET, 0);
Line 3205  bge_reset(struct bge_softc *sc)
Line 3206  bge_reset(struct bge_softc *sc)
                 marbmode = CSR_READ_4(sc, BGE_MARB_MODE);                  marbmode = CSR_READ_4(sc, BGE_MARB_MODE);
         CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE | marbmode);          CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE | marbmode);
   
         /* Step 17: Poll until the firmware iitializeation is complete */          /* Step 17: Poll until the firmware initialization is complete */
         bge_poll_fw(sc);          bge_poll_fw(sc);
   
         /* XXX 5721, 5751 and 5752 */          /* XXX 5721, 5751 and 5752 */
Line 3224  bge_reset(struct bge_softc *sc)
Line 3225  bge_reset(struct bge_softc *sc)
   
   
         /* Step 21: 5822 B0 errata */          /* Step 21: 5822 B0 errata */
         if (BGE_CHIPREV(sc->bge_chipid) == BGE_CHIPREV_5704_BX)          if (BGE_CHIPREV(sc->bge_chipid) == BGE_CHIPREV_5704_BX) {
                 BGE_SETBIT(sc, 0x66, 1 << 13 | 1 << 12 | 1 << 10);                  pcireg_t msidata;
   
                   msidata = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
                       BGE_PCI_MSI_DATA);
                   msidata |= ((1 << 13 | 1 << 12 | 1 << 10) << 16);
                   pci_conf_write(sc->sc_pc, sc->sc_pcitag, BGE_PCI_MSI_DATA,
                       msidata);
           }
   
         /* Step 23: restore cache line size */          /* Step 23: restore cache line size */
         pci_conf_write(sc->sc_pc, sc->sc_pcitag, BGE_PCI_CACHESZ, cachesize);          pci_conf_write(sc->sc_pc, sc->sc_pcitag, BGE_PCI_CACHESZ, cachesize);
Line 3295  bge_reset(struct bge_softc *sc)
Line 3303  bge_reset(struct bge_softc *sc)
  * on the receive return list.   * on the receive return list.
  *   *
  * Note: we have to be able to handle two possibilities here:   * Note: we have to be able to handle two possibilities here:
  * 1) the frame is from the jumbo recieve ring   * 1) the frame is from the jumbo receive ring
  * 2) the frame is from the standard receive ring   * 2) the frame is from the standard receive ring
  */   */
   
Line 3420  bge_rxeof(struct bge_softc *sc)
Line 3428  bge_rxeof(struct bge_softc *sc)
                 /*                  /*
                  * Handle BPF listeners. Let the BPF user see the packet.                   * Handle BPF listeners. Let the BPF user see the packet.
                  */                   */
                 if (ifp->if_bpf)                  bpf_mtap(ifp, m);
                         bpf_ops->bpf_mtap(ifp->if_bpf, m);  
   
                 m->m_pkthdr.csum_flags = M_CSUM_IPv4;                  m->m_pkthdr.csum_flags = M_CSUM_IPv4;
   
Line 4237  bge_start(struct ifnet *ifp)
Line 4244  bge_start(struct ifnet *ifp)
                  * If there's a BPF listener, bounce a copy of this frame                   * If there's a BPF listener, bounce a copy of this frame
                  * to him.                   * to him.
                  */                   */
                 if (ifp->if_bpf)                  bpf_mtap(ifp, m_head);
                         bpf_ops->bpf_mtap(ifp->if_bpf, m_head);  
         }          }
         if (pkts == 0)          if (pkts == 0)
                 return;                  return;
Line 4367  bge_init(struct ifnet *ifp)
Line 4373  bge_init(struct ifnet *ifp)
         callout_reset(&sc->bge_timeout, hz, bge_tick, sc);          callout_reset(&sc->bge_timeout, hz, bge_tick, sc);
   
 out:  out:
           sc->bge_if_flags = ifp->if_flags;
         splx(s);          splx(s);
   
         return error;          return error;
Line 4477  bge_ifmedia_sts(struct ifnet *ifp, struc
Line 4484  bge_ifmedia_sts(struct ifnet *ifp, struc
 }  }
   
 static int  static int
   bge_ifflags_cb(struct ethercom *ec)
   {
           struct ifnet *ifp = &ec->ec_if;
           struct bge_softc *sc = ifp->if_softc;
           int change = ifp->if_flags ^ sc->bge_if_flags;
   
           if ((change & ~(IFF_CANTCHANGE|IFF_DEBUG)) != 0)
                   return ENETRESET;
           else if ((change & (IFF_PROMISC | IFF_ALLMULTI)) == 0)
                   return 0;
   
           if ((ifp->if_flags & IFF_PROMISC) == 0)
                   BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_PROMISC);
           else
                   BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_PROMISC);
   
           bge_setmulti(sc);
   
           sc->bge_if_flags = ifp->if_flags;
           return 0;
   }
   
   static int
 bge_ioctl(struct ifnet *ifp, u_long command, void *data)  bge_ioctl(struct ifnet *ifp, u_long command, void *data)
 {  {
         struct bge_softc *sc = ifp->if_softc;          struct bge_softc *sc = ifp->if_softc;
Line 4487  bge_ioctl(struct ifnet *ifp, u_long comm
Line 4517  bge_ioctl(struct ifnet *ifp, u_long comm
         s = splnet();          s = splnet();
   
         switch (command) {          switch (command) {
         case SIOCSIFFLAGS:  
                 if ((error = ifioctl_common(ifp, command, data)) != 0)  
                         break;  
                 if (ifp->if_flags & IFF_UP) {  
                         /*  
                          * If only the state of the PROMISC flag changed,  
                          * then just use the 'set promisc mode' command  
                          * instead of reinitializing the entire NIC. Doing  
                          * a full re-init means reloading the firmware and  
                          * waiting for it to start up, which may take a  
                          * second or two.  
                          */  
                         if (ifp->if_flags & IFF_RUNNING &&  
                             ifp->if_flags & IFF_PROMISC &&  
                             !(sc->bge_if_flags & IFF_PROMISC)) {  
                                 BGE_SETBIT(sc, BGE_RX_MODE,  
                                     BGE_RXMODE_RX_PROMISC);  
                         } else if (ifp->if_flags & IFF_RUNNING &&  
                             !(ifp->if_flags & IFF_PROMISC) &&  
                             sc->bge_if_flags & IFF_PROMISC) {  
                                 BGE_CLRBIT(sc, BGE_RX_MODE,  
                                     BGE_RXMODE_RX_PROMISC);  
                         } else if (!(sc->bge_if_flags & IFF_UP))  
                                 bge_init(ifp);  
                 } else {  
                         if (ifp->if_flags & IFF_RUNNING)  
                                 bge_stop(ifp, 1);  
                 }  
                 sc->bge_if_flags = ifp->if_flags;  
                 error = 0;  
                 break;  
         case SIOCSIFMEDIA:          case SIOCSIFMEDIA:
                 /* XXX Flow control is not supported for 1000BASE-SX */                  /* XXX Flow control is not supported for 1000BASE-SX */
                 if (sc->bge_flags & BGE_PHY_FIBER_TBI) {                  if (sc->bge_flags & BGE_PHY_FIBER_TBI) {

Legend:
Removed from v.1.145.10.5  
changed lines
  Added in v.1.145.10.6

CVSweb <webmaster@jp.NetBSD.org>