Commit Graph

313 Commits

Author SHA1 Message Date
msaitoh 2a1c9b111a Revert part of if_bge.c 1.312. It's not reqired to mask other than VLAN ID
bits in VLAN tag.
2017-11-22 02:35:54 +00:00
christos 1706b6f5e4 - only get the vtag if we have it like the other drivers
- mask the hardware vlan tag
2017-09-28 16:24:39 +00:00
knakahara a6e88d7809 VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.
I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html

XXX need pullup to -8 branch
2017-09-26 07:42:05 +00:00
msaitoh b8e169d62e Use {isa,pci}_intr_establish"_xname"() for intrctl(8). 2017-04-27 10:01:53 +00:00
snj 35b2078af2 fix typo 2017-04-25 17:11:47 +00:00
msaitoh 26079ea3f0 5776[0156], 5778[02568] and 5779[015] are not Fast Ethernet but
Gigabit Ethernet.
2017-04-20 09:18:05 +00:00
msaitoh 07f767d482 Fix device timeout problem when MSI is used on BCM57762, BCM57765 and
BCM57785. Check correctly for BGEF_TAGGED_STATUS. These devices' ASCI core is
BCM5776[56]. Other BSD's BGE_IS_5717_PLUS() include BCM5776[56] but ours
doesn't (because Linux tg3 does so).

 Tested with snj's MacBook (BCM57765 (BCM57765 B0 ASIC)) and my Acer Aspire
One 756 (BCM57785(BCM57765 B0 ASIC)). Also Thunderbolt Ethernet
(BCM57762 (BCM57766 A0 ASIC)) should work.
2017-04-20 09:03:04 +00:00
msaitoh 233ee5301d Add forgotten BGE_EVCNT_INCR() for spurious interrupt. 2017-04-13 09:25:33 +00:00
msaitoh b734e166a9 - Read chip ID correctly on BCM57782 and BCM57786.
- Add BXCM57766 A0 string.
- Add comment for BCM5776[56]'s workaround.
2017-04-13 04:27:46 +00:00
msaitoh 92a8537b4b Add a workaround for BCM57780 to prevent device timeout. This change prevent
L1PM feature do wrongy. Tested with Dell latitude 2120.
2017-04-12 06:22:16 +00:00
msaitoh 44790b71a1 Fix a bug that BCM5785 write wrongly to the PCI config area. 2017-04-12 06:04:34 +00:00
msaitoh 6d4127c9b8 Add counters for spurious interrupts. 2017-04-12 05:59:43 +00:00
msaitoh 56d0e2153c Detach sysctl and event counters in bge_release_resources(). 2017-04-12 05:50:52 +00:00
ozaki-r dd8638eea5 Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input
The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
  - Where/When if_ipackets is counted up
  - Note that some drivers still update packet statistics in their own
    way (periodical update)
- Moved bpf_mtap run in softint
  - This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
2016-12-15 09:28:02 +00:00
ozaki-r c0e7885f20 Apply deferred if_start framework
if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
2016-12-08 01:12:00 +00:00
knakahara bf83a4a723 pci_intr_type() is required pci_chipset_tag_t argument by other than x86.
pointed out by nonaka@n.o.
2016-07-11 06:14:51 +00:00
ozaki-r d938d837b3 Introduce m_set_rcvif and m_reset_rcvif
The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
2016-06-10 13:27:10 +00:00
ozaki-r 040205ae93 Protect ifnet list with psz and psref
The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
2016-05-12 02:24:16 +00:00
ozaki-r 9c4cd06355 Introduce softint-based if_input
This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
2016-02-09 08:32:07 +00:00
msaitoh 87c2fc6098 Delete #ifdef __HAVE_PCI_MSI_MSIX and use pci_intr_allo()/pci_intr_release()
on any systems. The third argument of pci_intr_alloc() is left because we will
use the code to support MSI-X in future.
2015-11-18 10:26:57 +00:00
knakahara 66e958c1e5 mofity for if_wm and if_bge to use pci_intr_alloc() 2015-07-21 03:15:50 +00:00
martin 4b0b50f7a8 Make sure not to re-arm the statistics callout when we are about to detach. 2015-06-14 08:46:33 +00:00
msaitoh f9d1be49ed Remove debug printf(). 2015-05-23 13:44:40 +00:00
msaitoh de31d02840 Add missing pci_intr_release() for the detach. 2015-05-18 01:06:35 +00:00
msaitoh a064b0d392 Fix compile error on non-__HAVE_PCI_MSI_MSIX machines. 2015-05-17 14:23:15 +00:00
msaitoh ba36ca6815 - Add MSI support.
- Use tagged status function for 5717 and newer devices. All controllers
  except BCM5700 support tagged status but we use tagged status only for MSI
  case on BCM5717. Otherwise MSI on BCM5717 does not work. Same as other *BSDs.
2015-05-17 12:06:26 +00:00
msaitoh 38c1b17ca1 Add some workaround code for BGE_ASICREV_BCM5784 from Linux. 2015-05-01 03:42:15 +00:00
msaitoh 988569ba91 Remove PCI_PRODUCT_BROADCOM_BCM5724 and PCI_PRODUCT_BROADCOM_BCM5750M.
These devices have not released to public. Same as OpenBSD and Linux.
2015-05-01 03:26:43 +00:00
msaitoh 36903b682e Use another firmware command in bge_asf_driver_up(). Same as Linux.
This change fixes a bug that watchdog timeout occurs every 25-30 minutes
on HP ML110 G6 reported enami@ in PR#49657.
2015-04-30 16:09:06 +00:00
msaitoh 4f1ae97bea - BGE_CHIPID_BCM5784_A1 is not 0x5784100 but 0x5784001. Only dmesg output
is affected.
- Add BGE_CHIPREV_5784_AX and BGE_CHIPID_BCM5784_B0.
2015-04-30 15:48:46 +00:00
christos f7924c012b fix mbuf leak on failure (Brainy) 2015-04-27 17:38:01 +00:00
riastradh 233f556c2e Convert sys/dev to use <sys/rndsource.h>. 2015-04-13 16:33:23 +00:00
martin 58e6995b46 Make sure to halt (not just stop) the bge_tick callout during detach. 2015-04-06 07:38:17 +00:00
enami f9973cdc30 Make this file compiles again with BGE_DEBUG defined. 2015-02-17 23:07:56 +00:00
msaitoh a9f6de8334 Print bit setting of bge_asf_mode if BGE_DEBUG is set. 2015-02-17 10:11:24 +00:00
msaitoh a8791f7770 Fix three bugs reported by enami@:
- bge_miibus_writereg(): Fix a bug that BCM5906 may leave an APE lock.
 - Fix hwcfg4 isn't printed correctly.
 - Fix a bug that BGE_PHY_TEST_CTRL_REG isn't set correctly on some PCIe devices.
2015-02-11 23:07:13 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
msaitoh bcbb568e2a In the BCM5703, the DMA read watermark should be set to less than
or equal to the maximum memory read byte count of the PCI-X command
register. Same as FreeBSD r204978 and Linux tg3 driver.
2014-08-05 04:29:01 +00:00
msaitoh 4a7a38f5f8 Yet another change for PR#48451. Don't use prefetchable memory for BAR0, too.
Reported by taca@.
2014-07-24 13:22:49 +00:00
msaitoh 00ec96fde0 - Fix a bug that bge can't be initialized correctly on some sparc64 systems
(PR#49018).
  See also: http://mail-index.netbsd.org/port-sparc64/2013/10/28/msg002036.html
- Change initializaton order as the same as the document, Linux tg3 and FreeBSD
  (part of r241436).
2014-07-24 07:33:24 +00:00
msaitoh 781a405023 Add workaround for PR#48451. Some BCM5717-5720 based systems get NMI on boot.
This problem doesn't occur when we don't use prefetchable memory in the APE
area. I don't know the reason...  The way to not to use prefetchable memory
was adviced by Riastradh. Tested with HP MicroServer Gen8.
2014-07-22 17:25:19 +00:00
msaitoh 7675d4bbb7 Don't use the PHY Auto Poll Mode on many chips. This fixes a bug that MII
Fiber NIC drop packet about 50%. Same as {Free,Open}BSD.
Tested on HP Moonshot. Thanks zafer@ for testing.
2014-07-02 22:25:14 +00:00
msaitoh b72e30b6f7 Print APE firmware correctly. 2014-06-23 17:44:31 +00:00
msaitoh adbffa02af Add BGEPHYF_NO_WIRESPEED flag for fiber devices. 2014-06-17 22:29:13 +00:00
msaitoh e0d6a5e056 - Fix detection of BGEPHYF_FIBER_{MII|TBI}
- Add BCM5708S support in brgphy(4). The auto negotiation may have some bugs.
- Add 2500SX support (not tested).
- Fix bit definition of BRGPHY_MRBE_MSG_PG5_NP_T2 from FreeBSD.
2014-06-17 21:37:20 +00:00
msaitoh e65ce2179d Fix a variable name in last commit. 2014-06-17 18:18:51 +00:00
msaitoh 04840bd861 - Print yet another hardware config word in SRAM(BGE_SRAM_DATA_CFG_5) for
BCM5717 and newer devices.
- Fix a trivial bug in #ifdef NOTYET.
2014-06-17 17:37:08 +00:00
christos e58a356cba make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
2014-03-29 19:28:24 +00:00
pooka 4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
msaitoh 67459aa9d9 Revert previos. Sorry. 2013-11-07 18:45:32 +00:00