summaryrefslogtreecommitdiff
path: root/sys/dev/cs/if_cs.c
Commit message (Collapse)AuthorAgeFilesLines
* FCP-101: Remove cs(4).Brooks Davis2019-05-171-1229/+0
| | | | | | | | | | Relnotes: yes FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md Reviewed by: jhb, imp Differential Revision: https://reviews.freebsd.org/D20230 Notes: svn path=/head/; revision=347909
* Deprecate a number of less used 10 and 10/100 Ethernet devices.Brooks Davis2018-10-251-0/+2
| | | | | | | | | | | | | | The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe, pcn, sf, sn, tl, tx, txp, vx, wb, xe The list as refined as part of FCP-0101. Per the FCP, devices may be removed from the deprecation list if enough users are found or they are converted to iflib. FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md Notes: svn path=/head/; revision=339703
* 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
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. 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. Notes: svn path=/head/; revision=326255
* Remove register keyword from sys/ and ANSIfy prototypesEd Maste2017-05-171-1/+1
| | | | | | | | | | | | | | | A long long time ago the register keyword told the compiler to store the corresponding variable in a CPU register, but it is not relevant for any compiler used in the FreeBSD world today. ANSIfy related prototypes while here. Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10193 Notes: svn path=/head/; revision=318389
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().Justin Hibbits2016-02-271-2/+2
| | | | | | | | | | | Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370 Notes: svn path=/head/; revision=296137
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
* 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().Gleb Smirnoff2014-09-181-8/+8
| | | | Notes: svn path=/head/; revision=271836
* Delete pp_isadma. It isn't use, and the code that used it has beenWarner Losh2014-08-141-17/+1
| | | | | | | | | commented out (temporarily) since 1998 when this driver hit the tree. Also, no need to compute the ethernet header and then never use it. Notes: svn path=/head/; revision=269980
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-4/+2
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-2/+4
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* 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
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-2/+2
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Use bus space functions rather than inw/outwAndrew Turner2011-01-291-5/+5
| | | | | | | | | to help a future port of the driver to ARM. Approved by: imp (mentor) Notes: svn path=/head/; revision=218055
* Remove some always-true comparisons.John Baldwin2011-01-181-1/+1
| | | | | | | Submitted by: clang via rdivacky Notes: svn path=/head/; revision=217538
* Add new tunable 'net.link.ifqmaxlen' to set default send interfaceMaxim Sobolev2010-05-031-1/+1
| | | | | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month Notes: svn path=/head/; revision=207554
* Fix indentation nit.Warner Losh2010-01-181-1/+1
| | | | Notes: svn path=/head/; revision=202580
* Remove extraneous semicolons, no functional changes.Martin Blapp2010-01-071-1/+1
| | | | | | | | Submitted by: Marc Balmer <marc@msys.ch> MFC after: 1 week Notes: svn path=/head/; revision=201758
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/Robert Watson2009-06-261-2/+2
| | | | | | | | | | | | | | | | IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks Notes: svn path=/head/; revision=195049
* Improve the EEPROM parsing, based on finding a datasheet that describesWarner Losh2008-07-091-6/+6
| | | | | | | | | | | | | | | | | | it in detail. When setting media, don't error out when a specific media is selected. # Note: There may be some issues still here since the EtherJet PC Card doesn't # conform to the datasheet. Many different kinds of dongles can be plugged in # and it is unknown how to ask which one it is. Also, add a /* bad! */ comment to a 1/2 second delay after we set the DC/DC parameters. This should be a *sleep of some sort for !cold. Fortunately it is the only one and is only used when setting media, so the benefit from removing it is small. Unfortunately, it likely serves as an exemplar of good programming techniques, which it isn't. Notes: svn path=/head/; revision=180388
* Tweak a comment and a constant to restore old 30ms upper bound.Warner Losh2008-06-061-3/+3
| | | | | | | cs_readreg takes ~2us not ~1us to run. Notes: svn path=/head/; revision=179621
* o Remove unused cs_debug tunable. I think I added it and then nothing withWarner Losh2008-06-061-10/+22
| | | | | | | | | | | | | | it. Bad imp. Removing us dips us under 10,000 in size too. o Replace an unconditional 30ms DELAY (yes, busy wait) with a check of the SIBUSY bit in the SelfST register before accessing the eeprom. This changes the time to read the EEPROM from 2 * 20 * 30ms (1.2s) to < 20*25us (.0005s) and make the attach of the card tolerable when ethernet media is present. Include data from the datasheet about why this works. While this is a 2500x speed increase, it doesn't really matter at all once the card is probed... o set dev earlier in softc. Notes: svn path=/head/; revision=179620
* Minor clean up to shave about 1.5k off the size of the driver:Warner Losh2008-06-061-84/+6
| | | | | | | | | | | | o remove unused fields from softc and args from cs_alloc_irq o remove some commented code that will never be implemented. o Don't try to send a packet and see if it worked. We don't need this anymore, and it doesn't add any value. o tweaks for BNC and AUI. o limit possible time hung in the kernel to 4s rather than 40s. Notes: svn path=/head/; revision=179597
* Remove unused fields in softc. If they are ever really needed again,Warner Losh2008-06-061-17/+3
| | | | | | | | | they can re-added. Remove CS_NAME. Don't whine when there's an ignored checksum error: User has said STFU, so we should S the FU. (remove mandated properties). Notes: svn path=/head/; revision=179591
* Make the cs(4) driver MPSAFE:John Baldwin2008-06-051-55/+111
| | | | | | | | | | | | - Add a mutex to the softc to protect the softc and the device hardware. - Add a private timer to manage transmit watchdogs rather than using if_timer/if_watchdog. - Setup the interrupt handler after ether_ifattach(). Tested by: imp Notes: svn path=/head/; revision=179560
* Fix the media auto code by breaking it :-). Auto now just means 'useWarner Losh2008-06-051-19/+8
| | | | | | | | | | | | | | | 10BaseT' since it required 10BaseT to have carrier to switch to it. This chip makes it hard to do proper auto, so we don't do it. We can't test carrier on things easily. Don't insist on carrier when we set the media. Don't report failures. Remove a 1s! delay that appears to not be needed. With these patches, and John Baldwin's patches, I'm able to pass packets on my IBM EtherJet card again. Notes: svn path=/head/; revision=179553
* o Improve the probe code dealing with interrupts.Warner Losh2008-06-041-83/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | o When forced to be 10baseT, don't require that the 10baseT interface have link to succeed. Still require it for IFM_AUTO, however, since it appears that there's no way to tell if a specific type of interface worked. I'm doing a web search for a datasheet now to see if there's anything obvious. o Minor incidental formatting nits, including collapsing code of the form if (foo) { bar(); } else { if (baz) bing(); } into: if (foo) { bar(); } else if (baz) { bing(); } to save an indentation level. o Remove stray reference to 3.x config file syntax. # I believe John's patches still apply after this... Notes: svn path=/head/; revision=179532
* Correct logic error that would prevent cs pccards from working onWarner Losh2008-06-031-8/+8
| | | | | | | | | | | | systems where the CardBus bridge was connected to a APIC. The case where the probe routine is told to not setup the IRQ was mishandled but the error was masked in the case where the IRQ was a valid one for the card. MFC after: 1 week Notes: svn path=/head/; revision=179507
* - Consistently use if_printf() only in interface methods: if_start(),Gleb Smirnoff2006-09-151-12/+14
| | | | | | | | | | | if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name. Submitted by: Alex Lyashkov <umka sevcity.net> Notes: svn path=/head/; revision=162321
* Fix multicast support for cs89x0 chips. Just setting the RX_MULTCAST_ACCEPTPhilip Paeps2006-03-101-18/+56
| | | | | | | | | | | flag isn't enough - the filter needs to be set up too, or no multicast frames are accepted. Sponsored by: Philips Industrial Applications (indirectly) MFC after: 3 days Notes: svn path=/head/; revision=156559
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weWarner Losh2005-09-191-1/+1
| | | | | | | | | | could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call. Notes: svn path=/head/; revision=150306
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-08-091-12/+12
| | | | | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days Notes: svn path=/head/; revision=148887
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-101-28/+36
| | | | | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam Notes: svn path=/head/; revision=147256
* Fix the worst offenders of style(9) with a small style sweep.Warner Losh2005-01-281-48/+36
| | | | Notes: svn path=/head/; revision=140928
* Cleanup tabs vs spaces.Warner Losh2005-01-281-190/+189
| | | | Notes: svn path=/head/; revision=140927
* For the PC Card implementation of the CS8920M that's in my IBMWarner Losh2005-01-281-1/+2
| | | | | | | | | | | | | | | | EtherJet, the interrupt is selected in the eeprom based on the layout of the PC Card board. Since this is encoded into the EEPROM, and has no relationship to the IRQ that the pccard bridge routes the PC Card's interrupt pin to. As such, stop writing to that register. This gets my EtherJet working. # The eeprom reading code appears to be totally wrong for my EtherJet # card. This causes the card to bogusly detect the media options # available. Notes: svn path=/head/; revision=140926
* Setting hw.cs.recv_delay should set the delay, not the ignore theWarner Losh2005-01-281-1/+1
| | | | | | | eeprom checksum. Notes: svn path=/head/; revision=140925
* error = is needed before ether_ioctl() so that unsupported/unknownWarner Losh2005-01-281-1/+1
| | | | | | | | | | IOCLTs are properly handled. This gets the cs driver properly reporting things via ifconfig. # my pccard still doesn't work. Notes: svn path=/head/; revision=140921
* Write cs_detach() and use it. This resolves the twin problems of theWarner Losh2005-01-271-0/+16
| | | | | | | | cs1 interface linger on card eject, as well as the warnings about the card still using resources. Ooops. Notes: svn path=/head/; revision=140888
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Since if_cs doesn't contain locking or run with INTR_MPSAFE, markRobert Watson2004-08-131-1/+2
| | | | | | | the interface as IFF_NEEDSGIANT so if_start is run holding Giant. Notes: svn path=/head/; revision=133681
* We don't need to initialize if_output, ether_ifattach() does itMaxime Henrion2004-05-231-1/+0
| | | | | | | for us. Notes: svn path=/head/; revision=129616
* Remove improper use of if_addrhead in device drivers to checkLuigi Rizzo2004-04-151-4/+0
| | | | | | | | | | | | | | | if the link-level address has been initialized already. The majority of modern drivers never does this and works fine, which makes me think that the check is totally unnecessary and a residue of cut&paste from other drivers. This change is done to simplify locking because now almost none of the drivers uses this field. The exceptions are "ct" "ctau" and "cx" where i am not sure if i can remove that part. Notes: svn path=/head/; revision=128293
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-2/+2
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Announce ethernet MAC addresss in ether_ifattach().Matthew N. Dodd2004-03-141-4/+0
| | | | Notes: svn path=/head/; revision=126966
* o Add sysctl to allow ignoring checksum of eeprom.Warner Losh2003-11-041-47/+71
| | | | | | | | | | | | | | | o Fix minor type problems o Fix minor problem with a couple debug printfs. o Default to a sane media type when none is reported. o Minor style changes The PR complains this will fix the IBM 300GL cards. Submitted by: Max Gotlib PR: 11462 Notes: svn path=/head/; revision=122024