summaryrefslogtreecommitdiffstats
path: root/sys/dev/txp
Commit message (Collapse)AuthorAgeFilesLines
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-041-3/+3
| | | | malloc(9) flags in sys/dev.
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls tojhb2011-03-231-3/+3
| | | | pci_find_cap() instead.
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-121-1/+4
| | | | Commit the rest of the devices.
* Make sure rx descriptor ring align on 16 bytes. I guess theyongari2009-08-311-2/+4
| | | | | | | | | | alignment requirement could be multiple of 4 bytes but I think using descriptor size would make intention clearer. Previously the size of rx descriptor was not power of 2 so it caused panic in bus_dmamem_alloc(9). Reported by: Jeff Blank (jb000003 <> mr-happy dot com) MFC after: 3 days
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/rwatson2009-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
* bus_dma(9) conversion and make txp(4) work on all architectures.yongari2009-03-122-901/+2155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Header file cleanup. o bus_dma(9) conversion. - Removed all consumers of vtophys(9) and converted to use bus_dma(9). - Typhoon2 functional specification says the controller supports 64bit DMA addressing. However all Typhoon controllers are known to lack of DAC support so 64bit DMA support was disabled. - The hardware can't handle more 16 fragmented Tx DMA segments so teach txp(4) to collapse these segments to be less than 16. - Added Rx buffer alignment requirements(4 bytes alignment) and implemented fixup code to align receive frame. Previously txp(4) always copied Rx frame to align it on 2 byte boundary but its copy overhead is much higher than unaligned access on i386/amd64. Alignment fixup code is now applied only for strict-alignment architectures. With this change i386 and amd64 will get instant Rx performance boost. Typhoon2 datasheet mentions a command that pads arbitrary bytes in Rx buffer but that command does not work. - Nuked pointer trick in descriptor ring. This does not work on sparc64 and replaced it with bcopy. Alternatively txp(4) can embed a 32 bits index value into the descriptor and compute real buffer address but it may make code complicated. - Added endianness support code in various Tx/Rx/command/response descriptor access. With this change txp(4) should work on all architectures. o Added comments for known firmware bugs(Tx checksum offloading, TSO, VLAN stripping and Rx buffer padding control). o Prefer faster memory space register access to I/O space access. Added fall-back mechanism to use alternative I/O space access. The hardware supports both memory and I/O mapped access. Users can still force to use old I/O space access by setting hw.txp.prefer_iomap tunable to 1 in /boot/loader.conf. o Added experimental suspend/resume methods. o Nuke error prone Rx buffer handling code and implemented local buffer management with TAILQ. Be definition the controller can't pass the last received frame to host if no Rx free buffers are available to use as head and tail pointer of Rx descriptor ring can't have the same value. In that case the Rx buffer pointer in Rx buffer ring still holds a valid buffer and txp_rxbuf_reclaim() can't fill Rx buffers as the first buffer is still valid. Instead of relying on the value of Rx buffer ring, introduce local buffer management code to handle empty buffer situation. This should fix a long standing bug which completely hangs the controller under high network load. I could easily trigger the issue by sending 64 bytes UDP frames with netperf. I have no idea how this bugs was not fixed for a long time. o Converted ithread interrupt handler to filter based one. o Rearranged txp_detach routine such that it's now used for general clean-up routine. o Show sleep image version on device attach time. This will help to know what action should be taken depending on sleep image version. The version information in datasheet was wrong for newer NV images so I followed Linux which seems to correctly extract version numbers from response descriptors. o Firmware image is no longer downloaded in device attach time. Now it is reloaded whenever if_init is invoked. This is to ensure correct operation of hardware when something goes wrong. Previously the controller always run without regard to running state of firmware. This change will add additional controller initialization time but it give more robust operation as txp(4) always start off from a known state. The controller is put into sleep state until administrator explicitly up the interface. o As firmware is loaded in if_init handler, it's now possible to implement real watchdog timeout handler. When watchdog timer is expired, full-reset the controller and initialize the hardware again as most other drivers do. While I'm here use our own timer for watchdog instead of using if_watchdog/if_timer interface. o Instead of masking specific interrupts with TXP_IMR register, program TXP_IER register with the interrupts to be raised and use TXP_IMR to toggle interrupt generation. o Implemented txp_wait() to wait a specific state of a controller. o Separate boot related code from txp_download_fw() and name it txp_boot() to handle boot process. o Added bus_barrier(9) to host to ARM communication. o Added endianness to all typhoon command processing. The ARM93C always expects little-endian format of command/data. o Removed __STRICT_ALIGNMENT which is not valid on FreeBSD. __NO_STRICT_ALIGNMENT is provided for that purpose on FreeBSD. Previously __STRICT_ALIGNMENT was unconditionally defined for all architectures. o Rewrote SIOCSIFCAP ioctl handler such that each capability can be controlled by ifconfig(8). Note, disabling VLAN hardware tagging has no effect due to the bug of firmware. o Don't send TXP_CMD_CLEAR_STATISTICS to clear MAC statistics in txp_tick(). The command is not atomic. Instead, just read the statistics and reflect saved statistics to the statistics. dev.txp.%d.stats sysctl node provides detailed MAC statistics. This also reduces a lot of waste of CPU cycles as processing a command ring takes a very long time on ARM93C. Note, Rx multicast and broadcast statistics does not seem to right. It might be another bug of firmware. o Implemented link state change handling in txp_tick(). Now sending packets is allowed only after establishing a valid link. Also invoke link state change notification whenever its state is changed so pseudo drivers like lagg(4) that relies on link state can work with failover or link aggregation without hacks. if_baudrate is updated to resolved speed so SNMP agents can get correct bandwidth parameters. o Overhauled Tx routine such that it now honors number of allowable DMA segments and checks for 4 free descriptors before trying to send a frame. A frame may require 4 descriptors(1 frame descriptor, 1 or more frame descriptors, 1 TSO option descriptor, one free descriptor to prevent descriptor wrap-around) at least so it's necessary to check available free descriptors prior to setting up DMA operation. o Added a sysctl variable dev.txp.%d.process_limit to control how many received frames should be served in Rx handler. Valid ranges are 16 to 128(default 64) in unit of frames. o Added ALTQ(4) support. o Added missing IFCAP_VLAN_HWCSUM as txp(4) can offload checksum calculation as well as VLAN tag insertion/stripping. o Fixed media header length for VLAN. o Don't set if_mtu in device attach, it's already set in ether_ifattach(). o Enabled MWI. o Fixed module unload panic when bpf listeners are active. o Rearranged ethernet address programming logic such that it works on strict-alignment architectures. o Removed unused member variables in softc. o Added support for WOL. o Removed now unused TXP_PCI_LOMEM/TXP_PCI_LOIO. o Added wakeup command TXP_BOOTCMD_WAKEUP definition. o Added a new firmware version query command, TXP_CMD_READ_VERSION. o Removed volatile keyword in softc as bus_dmamap_sync(9) should take care of this. o Removed embedded union trick of a structure used to to access a pointer on LP64 systems. o Added a few TSO related definitions for struct txp_tcpseg_desc. However TSO is not used at all due to the limitation of hardware. o Redefined PKT_MAX_PKTLEN to theoretical maximum size of a frame. o Switched from bus_space_{read|write}_4 to bus_{read|write}_4. o Added a new macro TXP_DESC_INC to compute next descriptor index. Tested by: don.nasco <> gmail dot com
* Replace local CRC32 routine with ether_crc32_be(). This shouldyongari2009-03-112-49/+30
| | | | have happened long time ago. Also simplify Rx filter logic.
* s/u_int8_t/uint8_t/gyongari2009-03-112-182/+182
| | | | | | s/u_int16_t/uint16_t/g s/u_int32_t/uint32_t/g s/u_int64_t/uint64_t/g
* style(9) - space after keywords.yongari2009-03-111-14/+14
|
* Remove return statement at the end of function that returns void.yongari2009-03-111-20/+1
|
* Remove extra tab characters.yongari2009-03-111-3/+3
|
* K&R -> ANSI C function definitions.yongari2009-03-111-72/+34
|
* Update to latest 3Com firmware image. The latest fimware isyongari2009-02-253-4578/+3802
| | | | | | | | | | | | required to make 3CR990 familiy controllers run on NV flash firmware version 03.001.008. The latest firmware added HMAC digest information so teach txp(4) to pass them to sleep image before downloading is started. While I'm here restore previous IMR/IER register if firmware downloading have failed. PR: kern/89876, kern/132047
* Change the functions to ANSI in those cases where it breaks promotionrdivacky2009-02-241-19/+7
| | | | | | | | to int rule. See ISO C Standard: SS6.7.5.3:15. Approved by: kib (mentor) Reviewed by: warner Tested by: silence on -current
* Read MII_ANAR register and get common denominator ability.yongari2007-11-161-1/+6
| | | | PR: 92599
* IEEE 802.3 Annex 28B.3 explicitly specifies the following relativeyongari2007-11-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | 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 However PHY drivers didn't honor the order such that 100BASE-T4 had higher priority than 100BASE-TX full duplex. Fix that long standing bugs such that have PHY drivers choose the highest common denominator ability. Fix a bug in dcphy which inadvertently aceepts 100BASE-T4. PR: 92599
* Nuke duplicated __FBSDID.yongari2007-06-121-4/+0
|
* Add checks for contigmalloc(9) failure.yongari2007-06-121-0/+10
|
* Catch up the rest of the drivers with the ether_vlan_mtap modifications.csjp2007-03-041-1/+1
| | | | | | | | | | If these drivers are setting M_VLANTAG because they are stripping the layer 2 802.1Q headers, then they need to be re-inserting them so any bpf(4) peers can properly decode them. It should be noted that this is compiled tested only. MFC after: 3 weeks
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-1/+1
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* Move ethernet VLAN tags from mtags to its own mbuf packet header fieldandre2006-09-171-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content. Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field: m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG; to mark the packet m with the specified VLAN tag. On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid: if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... } VLAN tags are stored in host byte order. Byte swapping may be necessary. (Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.) Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done. Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
* Since DELAY() was moved, most <machine/clock.h> #includes have beenphk2006-05-161-1/+0
| | | | unnecessary.
* - Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag inglebius2005-12-181-2/+3
| | | | | | | | | case if memory allocation failed. - Remove fourth argument from VLAN_INPUT_TAG(), that was used incorrectly in almost all drivers. Indicate failure with mbuf value of NULL. In collaboration with: yongari, ru, sam
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-6/+6
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Remove call to txp_set_filter() from txp_attach(). txp_set_filter() needswpaul2005-10-291-2/+0
| | | | | | | | | | | | | | | the ifp, so you can't call it before doing if_alloc(). Also, there's really no need to call it here anyway: the code I originally ported from OpenBSD incorrectly set the station address only once at device attach time, instead of setting in txp_init(). This meant you couldn't change the address with ifconfig txp0 ether xx:xx:xx:xx:xx:xx. I added the call to txp_set_filter() in txp_init() to correct this, but forgot to remove the call from txp_attach(). Until now, it never mattered. With this fix, the txp driver tests good: txp0: <3Com 3cR990-TX-97 Etherlink with 3XP Processor> port 0xb800-0xb87f mem 0xe6800000-0xe683ffff irq 12 at device 10.0 on pci0 txp0: Ethernet address: 00:01:03:d4:91:4f
* - Add locking and mark MPSAFE. The driver had a mutex in the softc andjhb2005-10-272-62/+86
| | | | | | | | | | | | | | | even initialized it, but it never used it. - Use callout_*() to manage the callout. - Use m_devget() to copy data out of the rx buffers rather than doing it all by hand. - Use m_getcl() to allocate mbuf clusters rather than doing it all by hand. - Don't free the software descriptor for a rx ring entry if we can't allocate an mbuf cluster for it. We left a dangling pointer and never reallocated the entry anyway. OpenBSD's code (from which this was derived) has the same bug. Tested by: NO ONE (despite repeated requests) Reviewed by: wpaul (5)
* - Use PCIR_BAR().jhb2005-10-031-5/+2
| | | | - Remove unused TXP_PCI_INTLINE and TXP_DEVNAME macros.
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weimp2005-09-191-3/+3
| | | | | | | 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.
* Fixed a diagnostic message.ru2005-09-151-1/+1
|
* - Only call txp_release_resources() once if attach fails.jhb2005-08-311-38/+31
| | | | | | | - Set errno to ENXIO instead of 0 in several attach failure cases. - Setup the interrupt handler at the very end of txp_attach() after ether_ifattach(). - Various whitespace fixes in function prototypes.
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-9/+10
| | | | | | | | | | | | | | 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
* Modify device drivers supporting multicast addresses to lock if_addr_mtxrwatson2005-08-031-0/+2
| | | | | | | | over iteration of their multicast address lists when synchronizing the hardware address filter with the network stack-maintained list. Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca> MFC after: 1 week
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-102-26/+40
| | | | | | | | | | | | | | | | | | | | 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
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-2/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Use BUS_PROBE_DEFAULT in preference to 0. Also for vx, returnimp2005-03-011-1/+1
| | | | | BUS_PROBE_LOW_PRIORITY in stead of ifdef for devices that xl and vx both support so that xl will snarf them on up.
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-063-3/+3
|
* Since if_txp doesn't contain locking or run with INTR_MPSAFE, markrwatson2004-08-131-1/+2
| | | | | | | the interface as IFF_NEEDSGIANT so if_start is run holding Giant. Note: mutexes are initialized in the softc for this driver, but the locking appears inadequate to allow Giant-free operation.
* Remove the setting of the pci config variables on power state changes.imp2004-06-281-23/+0
| | | | The bus does this now.
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* We don't need to initialize if_output, ether_ifattach() does itmux2004-05-231-1/+0
| | | | for us.
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-3/+3
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-3/+0
|
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+1
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Use __FBSDID().obrien2003-08-241-0/+3
| | | | Also some minor style cleanups.
* All current uses of pci_set_powerstate are bogus, at least in theory.imp2003-07-031-2/+2
| | | | | | | | | | However, they are presently necessary due to bigger bogusness in the pci bus layer not doing the right thing on suspend/resume or on initial device probe. This is exactly the sort of thing that the BURN_BRIDGES option was invented for. Mark all of them as BURN_BRIDGES. As soon as I have the powerstate stuff properly integrated into the pci bus code, I intend to remove all these workarounds.
* - Don't call pci_enable_io() in drivers (unless needed for resume).mdodd2003-04-161-18/+0
| | | | | - Don't test memory/port status and emit an error message; the PCI bus code will do this now.
* - Express hard dependencies on bus (pci, isa, pccard) andmdodd2003-04-151-1/+3
| | | | | | | | network layer (ether). - Don't abuse module names to facilitate ifconfig module loading; such abuse isn't really needed. (And if we do need type information associated with a module then we should make it explicit and not use hacks.)
* Use __FBSDID rather than rcsid[].obrien2003-04-031-1/+3
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-6/+6
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-6/+6
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
OpenPOWER on IntegriCloud