summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_txp.c
AgeCommit message (Collapse)Author
2020-03-10On NetBSD it's spelled "__NO_STRICT_ALIGNMENT". Adjust txp_rx_reclaim()thorpej
accordingly and structure it like other NetBSD drivers so as to re-use the original Rx buffer rather than doing a needless free/alloc cycle. Note this happened to work previously on my Qube2 because IP, TCP, etc. perform their own alignment checks and react accordingly. However, it's not clear that ALL protocols do this yet, so it's better to just do the safe thing for now.
2020-03-10- Add support for MBUFTRACE.thorpej
- Fix an mbuf leak I introduced in rev 1.68 (failed to increment "cnt" variable in txp_start(), which subsequently caused txp_tx_reclaim() to never run). - Use the context address pointer in the Tx descriptor to stash the pointer to the Tx job software state in a manner like that which is used for Rx software state.
2020-03-09Add an assertion.thorpej
2020-03-09Now that we're allocating rx software state from a fixed pool, wethorpej
don't have to round-trip pointers in a sketchy way -- we can round- trip indices.
2020-03-09Allocate a static set of receive software state descriptors at attachthorpej
time, and create a simple allocator for them for use by the rx reclaim handlers. Don't create and destroy DMA maps for receoive buffers in the interrupt handlers -- just use the maps that are created at attach time.
2020-03-08Give each Tx DMA map 16 DMA segments rather than the previous absurdly largethorpej
number, and structure the loop in txp_start() similarly to other drivers (e.g. ste_start() in the ste(4) driver). Similar in spirit to OpenBSD's rev 1.126, but implemented a bit differently.
2020-03-08Upgrade to newer firmware needed by some txp(4) variants.thorpej
From FreeBSD via OpenBSD.
2020-03-08Follow the example of the MII code and don't register the half-duplexthorpej
versions of each media type.
2020-03-08- Use BUS_ADDR_{LO,HI}32(), and rather than forcing the descriptorthorpej
DMA addresses into a 64-bit value (and thus using 64-bit shifts when unnecessary), just reference the address from the DMA map directly. - Add some missing byte-swaps.
2020-02-29Use the 64-bit PCI DMA tag, if available.thorpej
2020-01-30Adopt <net/if_stats.h>.thorpej
2019-12-06localifymaxv
2019-11-10in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAITchs
and remove code to handle failures that can no longer happen.
2019-10-30 if_percpuq(9) automatically increments if_ipackets, so don't add number ofmsaitoh
RX frames from device's statistics counter to if_ipackets to avoid double count.
2019-07-09 Don't automatically set ec_capenable's ETHERCAP_VLAN_HWTAGGING bit inmsaitoh
vlan_config() to make it user-controllable. Instead, set the bit in xxx_attach().
2019-06-20 Fix panic on attach. This bug was added in rev. 1.56. I think it's notmsaitoh
required to call txp_set_filter() in the attach function.
2019-05-29Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA inmsaitoh
sys/net/if_ethersubr.c if we can. - Add ec_ifmedia into struct ethercom. - ec_mii in struct ethercom is kept and used as it is. It might be used in future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use ec_mii for keeping the if_media. Those should be changed in future.
2019-05-28 Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.msaitoh
2019-05-23No functional change:msaitoh
- Change ac(was arpcom) to ec(ethercom) - Simplify MII structure initialization. - u_int*_t -> uint*_t. - KNF
2019-05-07- Use bus_dmamem_unmap() correctly in txp_dma_free() to prevent panic.msaitoh
The code was wrong since rev. 1.1. This panic was found by adding KASSERT in uvm_map.c rev. 1.351. This bug may be related to PR kern/26204. - Use aprint_normal() for non-error message.
2019-04-26No functional change:msaitoh
- u_int_{8,16,32}_t -> uint_{8,16,32}_t - KNF. - Tabify. - Remove extra space.
2019-04-11 Fix a bug that the duplex of manual media setting may be wrongmsaitoh
when the IFM_GMASK bit other than IFM_[FH]DX is set.
2018-12-09use pci_intr_establish_xname() everywherejdolecek
2018-07-25 Initialize some members in a mbuf which is on stack.msaitoh
2018-06-26 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backwardmsaitoh
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same as FreeBSD. This change also fixes a bug that the direction is misunderstand on some environment by passing the direction to bpf_mtap*() instead of checking m->m_pkthdr.rcvif.
2017-09-26VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.knakahara
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
2016-12-15Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_inputozaki-r
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-08Apply deferred if_start frameworkozaki-r
if_schedule_deferred_start checks if the if_snd queue contains packets, so drivers don't need to check it by themselves.
2016-07-14- Use aprint*() more in xxx_attach().msaitoh
- Add missing aprint_naive("\n"). - Remove extra spaces and tabs. - KNF.
2016-07-14- Use aprint*() instead of printf() in xxx_attach().msaitoh
- Add missing aprint_naive("\n"); - KNF
2016-06-10Introduce m_set_rcvif and m_reset_rcvifozaki-r
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-02-09Introduce softint-based if_inputozaki-r
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!
2014-06-16 IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not fullmsaitoh
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set, but not for others. Same as {Free|Open}BSD.
2014-03-29make pci_intr_string and eisa_intr_string take a buffer and a lengthchristos
instead of relying in local static storage.
2012-10-27split device_t/softc for all remaining drivers.chs
replace "struct device *" with "device_t". use device_xname(), device_unit(), etc.
2010-11-13Don't pull in the whole uvm(9) API to access only PAGE_SIZE anduebayasi
some other constants. These are provided by sys/param.h now.
2010-04-05Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpfjoerg
check into the inline functions as well the fourth argument for bpf_attach.
2010-01-19Redefine bpf linkage through an always present op vector, i.e.pooka
#if NBPFILTER is no longer required in the client. This change doesn't yet add support for loading bpf as a module, since drivers can register before bpf is attached. However, callers of bpf can now be modularized. Dynamically loadable bpf could probably be done fairly easily with coordination from the stub driver and the real driver by registering attachments in the stub before the real driver is loaded and doing a handoff. ... and I'm not going to ponder the depths of unload here. Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2009-09-27Replace shutdownhook_establish(9) with pmf_device_register1(9).tsutsui
Compile test only.
2009-04-18Remove extra whitespace added by a stupid tool.tsutsui
XXX: more in src/sys/arch
2009-03-18bcopy -> memcpycegger
2009-03-18bzero -> memsetcegger
2009-03-18bcmp -> memcmpcegger
2009-03-14ANSIfy another 1261 function definitions.dsl
The only ones left in sys are beyond by sed script! (or in sys/dist or sys/external) Mostly they have function pointer parameters.
2009-03-14Change about 4500 of the K&R function definitions to ANSI ones.dsl
There are still about 1600 left, but they have ',' or /* ... */ in the actual variable definitions - which my awk script doesn't handle. There are also many that need () -> (void). (The script does handle misordered arguments.)
2009-02-16fix media priorities:cegger
IEEE 802.3 Annex 28B.3 specifies the following relative priorities of the technologies supported by 802.3 Selector Field value: 1000BASE-T full duplex 1000BASE-T 100BASE-T2 full duplex 100BASE-TX full duplex 100BASE-T2 100BASE-T4 100BASE-TX 10BASE-T full duplex 10BAST-T Our drivers give 100BASE-T4 a higher priority than 100BASE-TX full duplex. Fix this. This patch is based on changes in FreeBSD and OpenBSD. Patch presented on tech-kern and tech-net: http://mail-index.netbsd.org/tech-kern/2009/02/15/msg004397.html http://mail-index.netbsd.org/tech-net/2009/02/15/msg001064.html got no comments, no objections.
2008-11-07*** Summary ***dyoung
When a link-layer address changes (e.g., ifconfig ex0 link 02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor Advertisement to update the network-/link-layer address bindings on our LAN peers. Refuse a change of ethernet address to the address 00:00:00:00:00:00 or to any multicast/broadcast address. (Thanks matt@.) Reorder ifnet ioctl operations so that driver ioctls may inherit the functions of their "class"---ether_ioctl(), fddi_ioctl(), et cetera---and the class ioctls may inherit from the generic ioctl, ifioctl_common(), but both driver- and class-ioctls may override the generic behavior. Make network drivers share more code. Distinguish a "factory" link-layer address from others for the purposes of both protecting that address from deletion and computing EUI64. Return consistent, appropriate error codes from network drivers. Improve readability. KNF. *** Details *** In if_attach(), always initialize the interface ioctl routine, ifnet->if_ioctl, if the driver has not already initialized it. Delete if_ioctl == NULL tests everywhere else, because it cannot happen. In the ioctl routines of network interfaces, inherit common ioctl behaviors by calling either ifioctl_common() or whichever ioctl routine is appropriate for the class of interface---e.g., ether_ioctl() for ethernets. Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In the user->kernel interface, SIOCSIFADDR's argument was an ifreq, but on the protocol->ifnet interface, SIOCSIFADDR's argument was an ifaddr. That was confusing, and it would work against me as I make it possible for a network interface to overload most ioctls. On the protocol->ifnet interface, replace SIOCSIFADDR with SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to invoke SIOCINITIFADDR. In ifioctl(), give the interface the first shot at handling most interface ioctls, and give the protocol the second shot, instead of the other way around. Finally, let compatibility code (COMPAT_OSOCK) take a shot. Pull device initialization out of switch statements under SIOCINITIFADDR. For example, pull ..._init() out of any switch statement that looks like this: switch (...->sa_family) { case ...: ..._init(); ... break; ... default: ..._init(); ... break; } Rewrite many if-else clauses that handle all permutations of IFF_UP and IFF_RUNNING to use a switch statement, switch (x & (IFF_UP|IFF_RUNNING)) { case 0: ... break; case IFF_RUNNING: ... break; case IFF_UP: ... break; case IFF_UP|IFF_RUNNING: ... break; } unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and #ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4). In ipw(4), remove an if_set_sadl() call that is out of place. In nfe(4), reuse the jumbo MTU logic in ether_ioctl(). Let ethernets register a callback for setting h/w state such as promiscuous mode and the multicast filter in accord with a change in the if_flags: ether_set_ifflags_cb() registers a callback that returns ENETRESET if the caller should reset the ethernet by calling if_init(), 0 on success, != 0 on failure. Pull common code from ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(), and register if_flags callbacks for those drivers. Return ENOTTY instead of EINVAL for inappropriate ioctls. In zyd(4), use ENXIO instead of ENOTTY to indicate that the device is not any longer attached. Add to if_set_sadl() a boolean 'factory' argument that indicates whether a link-layer address was assigned by the factory or some other source. In a comment, recommend using the factory address for generating an EUI64, and update in6_get_hw_ifid() to prefer a factory address to any other link-layer address. Add a routing message, RTM_LLINFO_UPD, that tells protocols to update the binding of network-layer addresses to link-layer addresses. Implement this message in IPv4 and IPv6 by sending a gratuitous ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD messages on a change of an interface's link-layer address. In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address that is broadcast/multicast or equal to 00:00:00:00:00:00. Make ether_ioctl() call ifioctl_common() to handle ioctls that it does not understand. In gif(4), initialize if_softc and use it, instead of assuming that the gif_softc and ifp overlap. Let ifioctl_common() handle SIOCGIFADDR. Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels that certain invariants on a struct route are satisfied. In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit about the ioctls that we do not allow on an agr(4) member interface. bzero -> memset. Delete unnecessary casts to void *. Use sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with NULL instead of "testing truth". Replace some instances of (type *)0 with NULL. Change some K&R prototypes to ANSI C, and join lines.
2008-04-10use aprint_*_dev and device_xnamecegger
2008-04-09Use device_t and accessors. Use cfdata_t and __arraycount().dyoung
Miscellaneous cosmetic changes.
2008-04-09s/pcimatch/match/ to avoid conflict with a global name.dyoung