aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ti/if_ti.c
Commit message (Collapse)AuthorAgeFilesLines
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-06-281-5/+0
| | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740
* ti: Handle errors from copyin() and copyout()Mark Johnston2023-12-261-23/+33
| | | | | | | This is in preparation for annotating copyin() and related functions with __result_use_check. MFC after: 1 week
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Mechanically convert if_ti(4) to IfAPIJustin Hibbits2023-02-061-112/+111
| | | | | Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37806
* ti: Remove unused devclass argument to DRIVER_MODULE.John Baldwin2022-05-061-3/+1
|
* Fix "set but not used" for the ti driverScott Long2021-12-031-8/+8
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* Convert vm_page_alloc() callers to use vm_page_alloc_noobj().Mark Johnston2021-10-201-2/+1
| | | | | | | | | | | | | | | Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK. Similarly, convert vm_page_alloc_domain() callers. Note that callers are now responsible for assigning the pindex. Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31986
* Fix a common typo in man pages and src commentsGordon Bergling2021-08-281-1/+1
| | | | | | - s/desciptor/descriptor/ MFC after: 5 days
* ti: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-4/+0
| | | | Notes: svn path=/head/; revision=365145
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-34/+17
| | | | Notes: svn path=/head/; revision=353830
* Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).Mark Johnston2019-06-071-1/+1
| | | | | | | | | | | | | | | These calls are not the same in general: the former will dequeue the page if it is enqueued, while the latter will just leave it alone. But, all existing uses of the former apply to unmanaged pages, which are never enqueued in the first place. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20470 Notes: svn path=/head/; revision=348785
* ifnet: Replace if_addr_lock rwlock with epoch + mutexMatt Macy2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run on LLNW canaries and tested by pho@ gallatin: Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5 based ConnectX 4-LX NIC, I see an almost 12% improvement in received packet rate, and a larger improvement in bytes delivered all the way to userspace. When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1, I see, using nstat -I mce0 1 before the patch: InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32 4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32 4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32 4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32 4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32 4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32 4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32 After the patch InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51 5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51 5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51 5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51 5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52 5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52 Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15366 Notes: svn path=/head/; revision=333813
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Since the page "frame" doesn't belong to a vm object, it can't be pagedAlan Cox2017-09-241-1/+1
| | | | | | | | | | | | | out. Since it can't be paged out, it is never actually enqueued in a paging queue. Nonetheless, passing PQ_INACTIVE to vm_page_unwire() creates the appearance that the page "frame" is being enqueued in the inactive queue. As of r288122, we can avoid this false impression by passing PQ_NONE. MFC after: 1 week Notes: svn path=/head/; revision=323961
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-4/+4
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-211-5/+5
| | | | | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted. Notes: svn path=/head/; revision=298433
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-3/+3
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 andGleb Smirnoff2016-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | up to now. The new sendfile is the code that Netflix uses to send their multiple tens of gigabits of data per second. The new implementation features asynchronous I/O, when I/O operations are launched, but not awaited to be complete. An explanation of why such behavior is beneficial compared to old one is going to be too long for a commit message, so we will skip it here. Additional features of new syscall are extra flags, which provide an application more control over data sent. The SF_NOCACHE flag tells kernel that data shouldn't be cached after it was sent. The SF_READAHEAD() macro allows to specify readahead size in pages. The new syscalls is a drop in replacement. No modifications are required to applications. One can take nginx binary for stable/10 and run it successfully on head. Although SF_NODISKIO lost its original sense, as now sendfile doesn't block, and now means something completely different (tm), using the new sendfile the old way is absolutely safe. Celebrates: Netflix global launch! Sponsored by: Nginx, Inc. Sponsored by: Netflix Relnotes: yes Notes: svn path=/head/; revision=293439
* Fix r284722, by making it actually compile.Dimitry Andric2015-06-231-1/+1
| | | | | | | Pointy hat to: dim Notes: svn path=/head/; revision=284724
* Fix endless recursion in ti(4)'s ti_ifmedia_upd(), found by clang 3.7.0.Dimitry Andric2015-06-231-1/+1
| | | | Notes: svn path=/head/; revision=284722
* In order to reduce use of M_EXT outside of the mbuf allocator andRobert Watson2015-01-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value. With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations. NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature. Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=276750
* - Mechanically convert to if_inc_counter() the rest of counters.Gleb Smirnoff2014-09-261-31/+40
| | | | | | | | | | - Do not set if_collisions on interrupt, read them in ti_get_counter(). - Add missing bus_dmamap_sync(BUS_DMASYNC_PREREAD) in ti_ioctl2(). [1] Submitted by: mav [1] Notes: svn path=/head/; revision=272169
* Fix teardown of static DMA allocations in various NIC drivers:John Baldwin2014-06-171-15/+23
| | | | | | | | | | | | | | | | | - Add missing calls to bus_dmamap_unload() in et(4). - Check the bus address against 0 to decide when to call bus_dmamap_unload() instead of comparing the bus_dma map against NULL. - Check the virtual address against NULL to decide when to call bus_dmamem_free() instead of comparing the bus_dma map against NULL. - Don't clear bus_dma map pointers to NULL for static allocations. Instead, treat the value as completely opaque. - Pass the correct virtual address to bus_dmamem_free() in wpi(4) instead of trying to free a pointer to the virtual address. Reviewed by: yongari Notes: svn path=/head/; revision=267580
* - Modify vm_page_unwire() and vm_page_enqueue() to directly acceptAttilio Rao2014-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | the queue where to enqueue pages that are going to be unwired. - Add stronger checks to the enqueue/dequeue for the pagequeues when adding and removing pages to them. Of course, for unmanaged pages the queue parameter of vm_page_unwire() will be ignored, just as the active parameter today. This makes adding new pagequeues quicker. This change effectively modifies the KPI. __FreeBSD_version will be, however, bumped just when the full cache of free pages will be evicted. Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho Notes: svn path=/head/; revision=267548
* 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
* Remove unused and incomplete support for delayed fragment checksumsAndre Oppermann2013-08-191-18/+0
| | | | | | | from bce(4), bxe(4), mge(4) and ti(4) drivers. Notes: svn path=/head/; revision=254516
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-8/+8
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Remove duplicate const specifiers in many drivers (I hope I got all ofDimitry Andric2012-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | them, please let me know if not). Most of these are of the form: static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] }; The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata). I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files). Reviewed by: yongari, marius MFC after: 1 week Notes: svn path=/head/; revision=242625
* Remove TCP/UDP checksum offloading feature for IP fragmentedPyun YongHyeon2012-11-011-11/+5
| | | | | | | | | | | | | | | datagrams. Traditionally upper stack fragmented packets without computing TCP/UDP checksum and these datagrams were passed to driver. But there are chances that other packets slip into the interface queue in SMP world. If this happens firmware running on MIPS 4000 processor in the controller would see mixed packets and it shall send out corrupted packets. While I'm here simplify checksum offloading setup. MFC After: 1 week Notes: svn path=/head/; revision=242425
* Eliminate vestiges of page coloring.Alan Cox2011-12-151-2/+1
| | | | Notes: svn path=/head/; revision=228522
* Overhaul bus_dma(9) usage in driver:Pyun YongHyeon2011-11-141-372/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Notes: svn path=/head/; revision=227512
* Export sysctl node for various interrupt moderation parameters andPyun YongHyeon2011-11-141-14/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Notes: svn path=/head/; revision=227509
* It's bad idea to allocate large memory, 4KB, from stack.Pyun YongHyeon2011-11-141-29/+33
| | | | | | | | | | Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. Notes: svn path=/head/; revision=227505
* Remove dead ifdef. Driver should always check raised interrupt isPyun YongHyeon2011-11-101-3/+0
| | | | | | | for the device. Notes: svn path=/head/; revision=227432
* style.Pyun YongHyeon2011-11-101-63/+44
| | | | | | | No functional changes. Notes: svn path=/head/; revision=227431
* Retire 'options TI_PRIVATE_JUMBOS' and replace local jumboPyun YongHyeon2011-11-081-299/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | allocator with UMA backed jumbo allocator by default. Previously ti(4) used sf_buf(9) interface for jumbo buffers but it was broken at this moment such that enabling jumbo frame caused instant panic. Due to the nature of sf_buf(9) it heavily relies on VM changes but it seems ti(4) was not received much blessing from VM gurus. I don't understand VM magic and implications used in driver either. Switching to UMA backed jumbo allocator like other network drivers will make jumbo frame work on ti(4). While I'm here, fully allocate all RX buffers. This means ti(4) now uses 512 RX buffer and 1024 mini RX buffers. To use sf_buf(9) interface for jumbo buffers, introduce a new 'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better for jumbo buffers, interesting developers can fix the issue in future. ti(4) still needs more bus_dma(9) cleanups and should use separate DMA tag/map for each ring(standard, jumbo, mini, command, event etc) but it should work on all platforms except PAE. Special thanks to Jay[1] who provided complete remote debugging access. Tested by: Jay Borkenhagen <jayb <> braeburn dot org > [1] Notes: svn path=/head/; revision=227347
* Do not allow changing MTU to be less than the minimum.Pyun YongHyeon2011-11-071-1/+1
| | | | Notes: svn path=/head/; revision=227324
* If ti_chipinit() fails in ti_stop(), ignore the error and releasePyun YongHyeon2011-11-071-5/+5
| | | | | | | | all allocated TX/RX buffer resources. If the interface is brought to up again after the error, we will leak allocated TX/RX buffers. Notes: svn path=/head/; revision=227323
* Show RX buffer allocation failure and do not blindly send alivePyun YongHyeon2011-11-071-5/+21
| | | | | | | | | message to firmware. Probably the correct way for this error is to send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware handle the rest. Notes: svn path=/head/; revision=227322
* Mini ring is not available on Tigon 1 so do not create DMA maps forPyun YongHyeon2011-11-071-0/+5
| | | | | | | mini ring on Tigon 1 to save resources. Notes: svn path=/head/; revision=227319
* Track which ring was updated in RX handler and update only modifiedPyun YongHyeon2011-11-071-5/+12
| | | | | | | ring. This should reduce unnecessary register accesses. Notes: svn path=/head/; revision=227318
* o Remove unnecessary controller reinitialization.Pyun YongHyeon2011-11-071-2/+8
| | | | | | | | | | o Do not blindly UP controller when MTU is changed. Reinitialize controller only if driver is running. o Remove useless ti_stop() in ti_watchdog() since ti_init_locked() always invokes ti_stop(). Notes: svn path=/head/; revision=227312
* Remove ti_unit member variable in softc.Pyun YongHyeon2011-11-071-6/+5
| | | | | | | While I'm here use PCIR_BAR macro. Notes: svn path=/head/; revision=227311
* Implement altq(4) support.Pyun YongHyeon2011-11-041-8/+10
| | | | | | | | While I'm here fix a logic error in r227098 where it didn't re-enable interrupts when TX queue is empty. Notes: svn path=/head/; revision=227099
* Because ti(4) drops a driver lock in RX handler, check whetherPyun YongHyeon2011-11-041-4/+4
| | | | | | | driver is still running before re-enabling interrupts. Notes: svn path=/head/; revision=227098
* Don't abuse if_hwassist and make sure enabling corresponding TX/RXPyun YongHyeon2011-11-041-32/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | checksum offloading and VLAN hardware tag insertion/stripping from the currently enabled hardware offloading capabilities. Previously if_hwassist, which was initialized to TX/RX checksum offloading, was blindly used to enable both TX and RX checksum offloading such that disabling either TX or RX checksum offloading was not possible. ti(4) controllers support TX/RX checksum offloading with VLAN tagging so announce TX/RX checksum offloading capability over VLAN to vlan(4). Make VLAN hardware tag insertion/stripping honors currently enabled interface capability instead of blindly enabling VLAN hardware tagging. This change allows disabling hardware support of VLAN tag. Because ti(4) supports VLAN oversized frames, make network stack know the capability by setting if_hdrlen. While I'm here, rewrite SIOCSIFCAP handler and make sure to reinitialize controller whenever TX/RX checksum offloading and VLAN hardware tagging option is changed. The requirement of controller reinitialization comes from the limitation of Tigon I/II firmware. Tigon I/II firmware requires all related RCBs should be reinitialized whenever any of its hardware offloading capabilities change. vlan(4) is also notified whenever the parent interface's capability changes such that it can correctly handle TX/RX checksum offloading based on parent interface's enabled offloading capabilities. RX checksum offloading handler was changed to make upper stack use controller computed partial checksum value. Previously, ti(4) just set the computed value for any frames(IPv4, IPv6) and the value was not used in upper stack because driver didn't set CSUM_DATA_VALID such that upper network stack had to recompute checksum of TCP/UDP packets. I have no idea how this was not noticed for a long time. With this change, upper network stack does not have to fully recompute the checksum such that calculating pseudo checksum based on partial checksum is sufficient to know whether received packet's checksum is correct or not. However, I don't know why ti(4) does not have controller compute pseudo checksum as controller has ability to do it. I'm just guessing enabling that feature could trigger a firmware bug or could be slower than computing it on host side so just leave it as it was. In order not to produce false positives, ti(4) now checks whether controller actually computed IP or TCP/UDP checksum by checking ti_flags field. Notes: svn path=/head/; revision=227095
* Don't clear upper 4bits from VLAN tag information. It'sPyun YongHyeon2011-11-041-2/+2
| | | | | | | | responsibility of vlan(4) to extract VLAN id from the tag information and vlan(4) correctly handles it. Notes: svn path=/head/; revision=227094
* Introduce ti_ifmedia_upd_locked() to use in driver initializationPyun YongHyeon2011-11-041-3/+21
| | | | | | | | and add missing driver lock for both ti_ifmedia_upd() and ti_ifmedia_sts(). Notes: svn path=/head/; revision=227093
* Announce IFCAP_LINKSTATE capability and let network stack know linkPyun YongHyeon2011-11-041-7/+25
| | | | | | | | | | | | | state changes. Hide superfluous link up/down message under bootverbose since if_link_state_change(9) shows that information. While I'm here, change baudrate with the resolved speed of the established link instead of blindly setting it 1G. Unfortunately, it seems there is no way to differentiate 10/100Mbps from non-gigabit link so just assume we established a 100Mbps link if current link is not a gigabit link. Notes: svn path=/head/; revision=227092
* Make sure to unload loaded DMA area(descriptor, command, event ring).Pyun YongHyeon2011-11-041-0/+2
| | | | Notes: svn path=/head/; revision=227091