aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/e1000/if_lem.c
Commit message (Collapse)AuthorAgeFilesLines
* Migrate e1000 to the IFLIB framework:Sean Bruno2017-01-101-4730/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - em(4) igb(4) and lem(4) - deprecate the igb device from kernel configurations - create a symbolic link in /boot/kernel from if_em.ko to if_igb.ko Devices tested: - 82574L - I218-LM - 82546GB - 82579LM - I350 - I217 Please report problems to freebsd-net@freebsd.org Partial review from jhb and suggestions on how to *not* brick folks who originally would have lost their igbX device. Submitted by: mmacy@nextbsd.org MFC after: 2 weeks Relnotes: yes Sponsored by: Limelight Networks and Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8299 Notes: svn path=/head/; revision=311849
* Partial workaround for Intel PCI adapters reading past the end of theKonstantin Belousov2016-10-191-4/+15
| | | | | | | | | | | | | | host-programmed DMA regions. This change seemingly fixes the descriptor fetches, but the packet memory accesses are left problematic. Reviewed by: emaste, erj, sbruno Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8282 Notes: svn path=/head/; revision=307649
* remove conditional code for an obsolete feature. if_ptnet now does better.Luigi Rizzo2016-10-181-156/+0
| | | | Notes: svn path=/head/; revision=307573
* Remove uneeded parens.Sean Bruno2016-07-201-1/+1
| | | | | | | MFC after: 1 day Notes: svn path=/head/; revision=303110
* Do not initialize the adapter on MTU change when adapter status is down.Sean Bruno2016-07-071-1/+2
| | | | | | | | | | | | | | | This fixes long-standing problems when changing settings of the adapter. Discussed in: https://lists.freebsd.org/pipermail/freebsd-net/2016-June/045509.html Submitted by: arnaud.ysmal@stormshield.eu Reviewed by: erj@freebsd.org Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D7030 Notes: svn path=/head/; revision=302384
* dev/e1000,ixgbe: minor spelling fixes.Pedro F. Giffuni2016-05-061-2/+2
| | | | | | | | | No functional change. Differential Revision: https://reviews.freebsd.org/D6177 Notes: svn path=/head/; revision=299200
* Correct possible underflow conditions when checking for available spaceSean Bruno2016-04-181-1/+1
| | | | | | | | | | | | in the tx h/w ring buffer. Reviewed by: gnn jeb.j.cramer@intel.com MFC after: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D5918 Notes: svn path=/head/; revision=298224
* Given that em(4), lem(4) and igb(4) hardware doesn't require theMarius Strobl2016-01-131-5/+5
| | | | | | | | | | | | alignment guarantees provided by m_defrag(9), use m_collapse(9) instead for performance reasons. While at it, sanitize the statistics softc members, i. e. retire unused ones and add SYSCTL nodes missing for actually used ones. Differential Revision: https://reviews.freebsd.org/D4717 Notes: svn path=/head/; revision=293854
* Bump all copywrite dates to 2015Sean Bruno2015-08-161-1/+1
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D3160 Submitted by: erj MFC after: 2 weeks Sponsored by: Intel Corportation Notes: svn path=/head/; revision=286833
* e1000/if_lem.c bump to 1.1.0Sean Bruno2015-08-161-5/+1
| | | | | | | | | | | | - deprecate fbsd 8 Differential Revision: https://reviews.freebsd.org/D3164 Submitted by: erj MFC after: 2 weeks Sponsored by: Intel Corporation Notes: svn path=/head/; revision=286832
* Sync netmap sources with the version in our private tree.Luigi Rizzo2015-07-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following: - fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application) - exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey) - revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html - fix rx CRC handing on ixl - add module dependencies for netmap when building drivers as modules - minor simplifications to device-specific routines (*txsync, *rxsync) - general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code, Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open). Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers. MFC after: 1 month Sponsored by: (partly) Verisign, Cisco Notes: svn path=/head/; revision=285349
* Fix multiple incorrect SYSCTL arguments in the kernel:Hans Petter Selasky2014-10-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=273377
* - Remove empty wrappers ether_poll_[de]register_drv(). [1]Gleb Smirnoff2014-09-281-4/+4
| | | | | | | | | | - Move polling(9) declarations out of ifq.h back to if_var.h they are absolutely unrelated to queues. Submitted by: Mikhail <mp lenta.ru> [1] Notes: svn path=/head/; revision=272257
* - Use if_inc_counter() to increment various counters.Gleb Smirnoff2014-09-181-15/+26
| | | | | | | | | | | | - Do not ever set a counter to a value. For those counters that we don't increment, but return directly from hardware create cases in if_get_counter() method. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271782
* It is actually possible to have if_t a typedef to non-void type,Gleb Smirnoff2014-08-311-12/+12
| | | | | | | | | | | | | | and keep both converted to drvapi and non-converted drivers compilable. o Make if_t typedef to struct ifnet *. o Remove shim functions. Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270876
* Update to the current version of netmap.Luigi Rizzo2014-08-161-5/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly bugfixes or features developed in the past 6 months, so this is a 10.1 candidate. Basically no user API changes (some bugfixes in sys/net/netmap_user.h). In detail: 1. netmap support for virtio-net, including in netmap mode. Under bhyve and with a netmap backend [2] we reach over 1Mpps with standard APIs (e.g. libpcap), and 5-8 Mpps in netmap mode. 2. (kernel) add support for multiple memory allocators, so we can better partition physical and virtual interfaces giving access to separate users. The most visible effect is one additional argument to the various kernel functions to compute buffer addresses. All netmap-supported drivers are affected, but changes are mechanical and trivial 3. (kernel) simplify the prototype for *txsync() and *rxsync() driver methods. All netmap drivers affected, changes mostly mechanical. 4. add support for netmap-monitor ports. Think of it as a mirroring port on a physical switch: a netmap monitor port replicates traffic present on the main port. Restrictions apply. Drive carefully. 5. if_lem.c: support for various paravirtualization features, experimental and disabled by default. Most of these are described in our ANCS'13 paper [1]. Paravirtualized support in netmap mode is new, and beats the numbers in the paper by a large factor (under qemu-kvm, we measured gues-host throughput up to 10-12 Mpps). A lot of refactoring and additional documentation in the files in sys/dev/netmap, but apart from #2 and #3 above, almost nothing of this stuff is visible to other kernel parts. Example programs in tools/tools/netmap have been updated with bugfixes and to support more of the existing features. This is meant to go into 10.1 so we plan an MFC before the Aug.22 deadline. A lot of this code has been contributed by my colleagues at UNIPI, including Giuseppe Lettieri, Vincenzo Maffione, Stefano Garzarella. MFC after: 3 days. Notes: svn path=/head/; revision=270063
* - Don't compare bus_dma map pointers for static DMA allocations againstJohn Baldwin2014-06-121-3/+5
| | | | | | | | | | | NULL to determine if bus_dmamap_unload() or bus_dmamem_free() should be called. Instead, check the associated bus and virtual addresses. - Don't clear static DMA maps to NULL. Reviewed by: jfv Notes: svn path=/head/; revision=267385
* Convert em(4) to use the driver API.Marcel Moolenaar2014-06-021-203/+168
| | | | | | | | Submitted by: Anuranjan Shukla <anshukla@juniper.net> Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=266978
* It is 2014 and we have a new version of netmap.Luigi Rizzo2014-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most relevant features: - netmap emulation on any NIC, even those without native netmap support. On the ixgbe we have measured about 4Mpps/core/queue in this mode, which is still a lot more than with sockets/bpf. - seamless interconnection of VALE switch, NICs and host stack. If you disable accelerations on your NIC (say em0) ifconfig em0 -txcsum -txcsum you can use the VALE switch to connect the NIC and the host stack: vale-ctl -h valeXX:em0 allowing sharing the NIC with other netmap clients. - THE USER API HAS SLIGHTLY CHANGED (head/cur/tail pointers instead of pointers/count as before). This was unavoidable to support, in the future, multiple threads operating on the same rings. Netmap clients require very small source code changes to compile again. On the plus side, the new API should be easier to understand and the internals are a lot simpler. The manual page has been updated extensively to reflect the current features and give some examples. This is the result of work of several people including Giuseppe Lettieri, Vincenzo Maffione, Michio Honda and myself, and has been financially supported by EU projects CHANGE and OPENLAB, from NetApp University Research Fund, NEC, and of course the Universita` di Pisa. Notes: svn path=/head/; revision=260368
* use the correct netmap <-> nic slot mapping on the transmit ring for 'lem'.Luigi Rizzo2013-12-261-1/+1
| | | | | | | | | | This bug would manifest only in netmap mode and on packets transmitted after a NIC reset while netmap mode is active. MFC after: 3 days Notes: svn path=/head/; revision=259907
* Fix several issues with the busdma(9) KPI use in the e1000 drivers.Konstantin Belousov2013-11-021-4/+2
| | | | | | | | | | | | | | | | | | The problems do not affect bouncing busdma in a visible way, but are critical for the dmar backend. - The bus_dmamap_create(9) is not documented to take BUS_DMA_NOWAIT flag. - Unload descriptor map after receive. - Do not reset descriptor map to NULL, bus_dmamap_load(9) requires valid map, and also this leaks the map. Reported and tested by: pho Approved by: jfv Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=257541
* update to the latest netmap snapshot.Luigi Rizzo2013-11-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | This includes the following: - use separate memory regions for VALE ports - locking fixes - some simplifications in the NIC-specific routines - performance improvements for the VALE switch - some new features in the pkt-gen test program - documentation updates There are small API changes that require programs to be recompiled (NETMAP_API has been bumped so you will detect old binaries at runtime). In particular: - struct netmap_slot now is 16 bytes to support an extra pointer, which may save one data copy when using VALE ports or VMs; - the struct netmap_if has two extra fields; MFC after: 3 days Notes: svn path=/head/; revision=257529
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIScott Long2013-08-121-9/+1
| | | | | | | | | | | | | | | | | | | | command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day Notes: svn path=/head/; revision=254263
* Change the E1000 driver option header handling to match theJack F Vogel2013-07-121-2/+3
| | | | | | | | | | | | | ixgbe driver. As it was, when building them as a module INET and INET6 are not defined. In these drivers it does not cause a panic, however it does result in different behavior in the ioctl routine when you are using a module vs static, and I think the behavior should be the same. MFC after: 3 days Notes: svn path=/head/; revision=253303
* if_lem.c: make sure that lem_rxeof() can drain the entire rx queueLuigi Rizzo2013-05-091-3/+15
| | | | | | | | | | | | | | | irrespective of the setting of lem_rx_process_limit, while giving a chance to the taskqueue scheduler to act after each chunk. This makes lem_rxeof similar to the one in if_em.c and if_igb.c . if_lem.c and if_em.c: add a sysctl to manually configure the 'itr' moderation register. Approved by: Jack Vogel Notes: svn path=/head/; revision=250414
* simplify the code to initialize the RDT while in netmap mode.Luigi Rizzo2013-05-091-10/+4
| | | | Notes: svn path=/head/; revision=250413
* use netmap_rx_irq() and netmap_tx_irq() instead of replicating theLuigi Rizzo2013-04-301-10/+3
| | | | | | | logic in the individual driver. Notes: svn path=/head/; revision=250109
* Correct the multicast handling in the E1000 drivers as wasJack F Vogel2013-04-031-4/+29
| | | | | | | | | done in ixgbe, thanks to Mike Karels for this fix. When exiting promiscuous mode MPE bit was being unconditionally cleared, this should not be done if we are in MAX multicast groups. Notes: svn path=/head/; revision=249074
* Refresh on the shared code for the E1000 drivers.Jack F Vogel2013-02-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | - bear with me, there are lots of white space changes, I would not do them, but I am a mere consumer of this stuff and if these drivers are to stay in shape they need to be taken. em driver changes: support for the new i217/i218 interfaces igb driver changes: - TX mq start has a quick turnaround to the stack - Link/media handling improvement - When link status changes happen the current flow control state will now be displayed. - A few white space/style changes. lem driver changes: - the shared code uncovered a bogus write to the RLPML register (which does not exist in this hardware) in the vlan code,this is removed. Notes: svn path=/head/; revision=247064
* Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on ↵Sofian Brabez2013-01-301-1/+1
| | | | | | | | | | device_method_t arrays Reviewed by: cognet Approved by: cognet Notes: svn path=/head/; revision=246128
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-3/+3
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Now that device disabling is generic, remove extraneous code from theEitan Adler2012-10-221-5/+0
| | | | | | | | | | | | | device drivers that used to provide this feature. This is a subset of 241856 (which was reverted) Reviewed by: des Approved by: cperciva (implicit) MFC after: 1 week Notes: svn path=/head/; revision=241917
* This isn't functionally identical. In some cases a hint to disableEitan Adler2012-10-221-0/+5
| | | | | | | | | | | unit 0 would in fact disable all units. This reverts r241856 Approved by: cperciva (implicit) Notes: svn path=/head/; revision=241885
* Now that device disabling is generic, remove extraneous code from theEitan Adler2012-10-221-5/+0
| | | | | | | | | | | device drivers that used to provide this feature. Reviewed by: des Approved by: cperciva MFC after: 1 week Notes: svn path=/head/; revision=241856
* remove duplicate semicolons where possible.Eitan Adler2012-10-221-1/+1
| | | | | | | | Approved by: cperciva MFC after: 1 week Notes: svn path=/head/; revision=241844
* This patch fixes a nit in the em, lem, and igb driver statistics. IncrementSean Bruno2012-09-231-1/+1
| | | | | | | | | | | | adapter->dropped_pkts instead of if_ierrors because if_ierrors is overwritten by hw stats collection. Submitted by: Andrew Boyer <aboyer@averesystems.com> Reviewed by: Jack F Vogel <jfv@freebsd.org> MFC after: 2 weeks Notes: svn path=/head/; revision=240879
* Clean up some unused leftover code from emJack F Vogel2012-07-311-74/+30
| | | | | | | | | | Make IRQ style a tuneable Fix lock handling in the interrupt handler MFC after:3 days Notes: svn path=/head/; revision=238953
* remove some extra testing code that slipped into the previous commitLuigi Rizzo2012-07-251-33/+0
| | | | | | | Reported-by: Alexander Motin Notes: svn path=/head/; revision=238770
* Use legacy interrupts as a default. This gives up to 10% speedupLuigi Rizzo2012-07-251-0/+34
| | | | | | | | | | | when used in qemu (and this driver is for non-PCIe cards, so probably its largest use is in virtualized environments). Approved by: Jack Vogel MFC after: 3 days Notes: svn path=/head/; revision=238765
* A bunch of netmap fixes:Luigi Rizzo2012-02-271-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USERSPACE: 1. add support for devices with different number of rx and tx queues; 2. add better support for zero-copy operation, adding an extra field to the netmap ring to indicate how many buffers we have already processed but not yet released (with help from Eddie Kohler); 3. The two changes above unfortunately require an API change, so while at it add a version field and some spares to the ioctl() argument to help detect mismatches. 4. update the manual page for the two changes above; 5. update sample applications in tools/tools/netmap KERNEL: 1. simplify the internal structures moving the global wait queues to the 'struct netmap_adapter'; 2. simplify the functions that map kring<->nic ring indexes 3. normalize device-specific code, helps mainteinance; 4. start exploring the impact of micro-optimizations (prefetch etc.) in the ixgbe driver. Use 'legacy' descriptors on the tx ring and prefetch slots gives about 20% speedup at 900 MHz. Another 7-10% would come from removing the explict calls to bus_dmamap* in the core (they are effectively NOPs in this case, but it takes expensive load of the per-buffer dma maps to figure out that they are all NULL. Rx performance not investigated. I am postponing the MFC so i can import a few more improvements before merging. Notes: svn path=/head/; revision=232238
* (This commit only touches code within the DEV_NETMAP blocks)Luigi Rizzo2012-02-151-8/+4
| | | | | | | | | | | | Introduce some functions to map NIC ring indexes into netmap ring indexes and vice versa. This way we can implement the bound checks only in one place (and hopefully in a correct way). On passing, make the code and comments more uniform across the various drivers. Notes: svn path=/head/; revision=231796
* small code cleanup in preparation for future modifications inLuigi Rizzo2012-01-101-10/+8
| | | | | | | | | | the memory allocator used by netmap. No functional change, two small bug fixes: - in if_re.c add a missing bus_dmamap_sync() - in netmap.c comment out a spurious free() in an error handling block Notes: svn path=/head/; revision=229939
* ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againKevin Lo2012-01-071-1/+0
| | | | | | | Reviewed by: yongari Notes: svn path=/head/; revision=229767
* When extracting the VLAN tag from if_em and if_lem receive descriptorRobert Watson2012-01-051-2/+1
| | | | | | | | | | | | | rings, copy the whole VLAN tag, not just the VLAN ID. This fixes a problem in which VLAN priority information was dropped when using offloaded VLAN processing with these drivers. Discussed with: jfv, rrs Sponsored by: ADARA Networks, Inc. MFC after: 3 days Notes: svn path=/head/; revision=229606
* Part 2 of 2 New deltas for the 1G drivers.Jack F Vogel2011-12-101-30/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There have still been intermittent problems with apparent TX hangs for some customers. These have been problematic to reproduce but I believe these changes will address them. Testing on a number of fronts have been positive. EM: there is an important 'chicken bit' fix for 82574 in the shared code this is supported in the core here. - The TX path has been tightened up to improve performance. In particular UDP with jumbo frames was having problems, and the changes here have improved that. - OACTIVE has been used more carefully on the theory that some hangs may be due to a problem in this interaction - Problems with the RX init code, the "lazy" allocation and ring initialization has been found to cause problems in some newer client systems, and as it really is not that big a win (its not in a hot path) it seems best to remove it. - HWTSO was broken when VLAN HWTAGGING or HWFILTER is used, I found this was due to an error in setting up the descriptors in em_xmit. IGB: - TX is also improved here. With multiqueue I realized its very important to handle OACTIVE only under the CORE lock so there are no races between the queues. - Flow Control handling was broken in a couple ways, I have changed and I hope improved that in this delta. - UDP also had a problem in the TX path here, it was change to improve that. - On some hardware, with the driver static, a weird stray interrupt seems to sometimes fire and cause a panic in the RX mbuf refresh code. This is addressed by setting interrupts late in the init path, and also to set all interrupts bits off at the start of that. Notes: svn path=/head/; revision=228387
* add netmap support for "em", "lem", "igb" and "re".Luigi Rizzo2011-12-051-0/+79
| | | | | | | | | | | | | | | | | On my hardware, "em" in netmap mode does about 1.388 Mpps on one card (on an Asus motherboard), and 1.1 Mpps on another card (PCIe bus). Both seem to be NIC-limited, because i have the same rate even with the CPU running at 150 MHz. On the "re" driver the tx throughput is around 420-450 Kpps on various (8111C and the like) chipsets. On the Rx side performance seems much better, and i can receive the full load generated by the "em" cards. "igb" is untested as i don't have the hardware. Notes: svn path=/head/; revision=228281
* Clear transmit checksum offload context state upon lem(4) interfaceRyan Stone2011-09-171-0/+1
| | | | | | | | | | | | | | initialization. Prior to this change packets may be transmitted with an incorrect checksum. Em(4) already has an equivalent change in r213234. Obtained From: Sandvine MFC After: 1 week Approved by: re (bz) Notes: svn path=/head/; revision=225640
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin2011-03-231-1/+1
| | | | | | | pci_find_cap() instead. Notes: svn path=/head/; revision=219902
* Specify a CTLTYPE_FOO so that a future sysctl(8) change does not needMatthew D Fleming2011-01-181-6/+6
| | | | | | | to rely on the format string. Notes: svn path=/head/; revision=217556