Commit Graph

30 Commits

Author SHA1 Message Date
Andrew Gallatin
e0501fd040 - Add handling of MXGEFW_CMD_UNKNOWN in mxge_send_cmd().
- Convert mxge_send_cmd result handling to a switch rather
  than adding a new elseif for MXGEFW_CMD_UNKNOWN

Sponsored by: Myricom Inc.
2007-05-08 18:45:43 +00:00
Andrew Gallatin
8fe615ba76 Firmware update & improvements to firmware selection:
- Update to latest (1.4.17) firmware.

- Use the new MXGEFW_CMD_UNALIGNED_TEST (added in firmare 1.4.16) to
  have the firmware tell us if the PCIe chipset supports aligned PCIe
  completions.

- Hard to maintain, and frequently out of date whitelist of PCIe
  chipsets known to produce aligned completions removed, as it has been
  replaced in its role of selecting the correct firmware to run by the
  use of MXGEFW_CMD_UNALIGNED_TEST.

- Break the dma test out of mxge_reset() and into its own function
  (mxge_dma_test()) so it can be used by both the normal DMA test, and
  to run the unaligned test.

- Improved support for enabling ECRCs

Sponsored by: Myricom Inc.
2007-05-08 14:19:43 +00:00
Andrew Gallatin
9b03b0f3c0 -Fix an mbuf leak caused by a cut&paste bug where the small ring's mbufs
were never freed, but the big ring was freed twice.
-Don't supply rx hw csums for frames which are padded beyond the
 length specified in the ip header.  If the padding is non-zero,
 the hw csum will be incorrect for such frames.

Sponsored by: Myricom
2007-04-27 13:11:50 +00:00
Andrew Gallatin
e39a0a37cf - Fix a bug in the TSO transmit routine where frames which had
been defragged and had their headers in the same cluster as their
payload would be fed to the NIC in header-sized chunks, and would
likely exceed the number of available transmit descriptors.

- If a TSO frame exceeds the number of available transmit descriptors,
don't leak busdmma resources when freeing it.

Sponsored by: Myricom Inc.
2007-04-03 10:41:33 +00:00
John Baldwin
4e7f640dfb Optimize sx locks to use simple atomic operations for the common cases of
obtaining and releasing shared and exclusive locks.  The algorithms for
manipulating the lock cookie are very similar to that rwlocks.  This patch
also adds support for exclusive locks using the same algorithm as mutexes.

A new sx_init_flags() function has been added so that optional flags can be
specified to alter a given locks behavior.  The flags include SX_DUPOK,
SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature
to the similar flags for mutexes.

Adaptive spinning on select locks may be enabled by enabling the
ADAPTIVE_SX kernel option.  Only locks initialized with the SX_ADAPTIVESPIN
flag via sx_init_flags() will adaptively spin.

The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock()
are now performed inline in non-debug kernels.  As a result, <sys/sx.h> now
requires <sys/lock.h> to be included prior to <sys/sx.h>.

The new kernel option SX_NOINLINE can be used to disable the aforementioned
inlining in non-debug kernels.

The size of struct sx has changed, so the kernel ABI is probably greatly
disturbed.

MFC after:	1 month
Submitted by:	attilio
Tested by:	kris, pjd
2007-03-31 23:23:42 +00:00
Andrew Gallatin
40385a5f33 Fix a bug which could lead to receive side lockup when WC is disabled.
When submitting rx buffers and not using WC fifo, always replace the
invalid DMA address with the real one, otherwise allocation failures
could lead to the invalid DMA address being given to the NIC, and
that would cause the receive side to lockup.
2007-03-27 15:55:32 +00:00
Andrew Gallatin
21b49cfcaa Update mxge's firmware from a fairly old version (1.4.6) to the most
recent version (1.4.12).

Firmware changelogs are available on Myricom's web site at:
http://www.myri.com/scs/CHANGES/CHANGES.myri10ge-firmware

Sponsored by: Myricom Inc.
2007-03-08 17:49:06 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
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@
2007-02-23 12:19:07 +00:00
Andrew Gallatin
b824b7d86a Work around a firmware bug where broadcast frames would be incorrectly
treated as multicast frames and filtered, but when only when "adopting"
running firmware.  By "adopting", I mean using pre-existing firmware
loaded from eeprom at PCI reset, rather than firmware loaded by the
driver.
2007-02-21 17:34:05 +00:00
Luigi Rizzo
33d5497079 Cleanup and document the implementation of firmware(9) based on
a version that i posted earlier on the -current mailing list,
and subsequent feedback received.

The core of the change is just in sys/firmware.h and kern/subr_firmware.c,
while other files are just adaptation of the clients to the ABI change
(const-ification of some parameters and hiding of internal info,
so this is fully compatible at the binary level).

In detail:
- reduce the amount of information exported to clients in struct firmware,
  and constify the pointer;

- internally, document and simplify the implementation of the various
  functions, and make sure error conditions are dealt with properly.

The diffs are large, but the code is really straightforward now (i hope).

Note also that there is a subtle issue with the implementation of
firmware_register(): currently, as in the previous version, we just
store a reference to the 'imagename' argument, but we should rather
copy it because there is no guarantee that this is a static string.
I realised this while testing this code, but i prefer to fix it in
a later commit -- there is no regression with respect to the past.

Note, too, that the version in RELENG_6 has various bugs including
missing locks around the module release calls, mishandling of modules
loaded by /boot/loader, and so on, so an MFC is absolutely necessary
there.  I was just postponing it until this cleanup to avoid doing
things twice.

MFC after: 1 week
2007-02-15 17:21:31 +00:00
Andrew Gallatin
dce01b9b27 - Add 99% of a callout based watchdog. The remaining 1% is waiting
for pci_cfg_restore() to be exported.  It was tested using a
  hackily accessed pci_cfg_restore().

- Add ifmedia_removeall() to mxge_detach() in order to stop leaking
  an ifaddr

- Fix a small acounting bug introduced by the locking code shuffle
  which could cause spurious watchdog resets now that we have a
  watchdog.

Sponsored by: Myricom
2007-01-31 19:53:36 +00:00
Andrew Gallatin
c265717682 destroy busdma maps even if they are NULL, so as to avoid leaking
busdma tags.
2007-01-31 15:47:44 +00:00
Andrew Gallatin
a98d6cd71c Abandon using sleepable locks in favor of mutexes for mxge's if_ioctl
locking in preparation for adding a watchdog handler (callouts must
not use sleepable locks).  This required shuffling memory and
interrupt allocation to the attach routine rather than if_ioctl so as
to avoid potential sleeps while bringing up the interface.
2007-01-31 15:29:31 +00:00
Andrew Gallatin
a82c2581b5 Minor updates:
- initialize ifq_drv_maxlen correctly
- mark the interface as jumbo capable
- keep stats on the number of times the hw transmit queue filled and
  was restarted.
2007-01-30 08:39:44 +00:00
Andrew Gallatin
a1480dfbad Fix mxge_submit_8rx() to behave like the comments says it does,
and ensure that it copies at most 32 bytes at a time.
2006-11-29 15:30:39 +00:00
Andrew Gallatin
a8ebcb1bc0 Fix transposition of width and value arguments to pci_config_write()
when setting up the read request size.

Pointed out by: kmacy
2006-11-22 18:47:24 +00:00
Andrew Gallatin
d91b1b4976 Initialization bugfixes and enhancements:
- Fix bug preventing adoption of running firmware
- Set PCIe max read request size to 4KB
- Read PCIe link width from config space
- Assume aligned completions from the southbridge ports
  of intel E5000 chips
- Use aligned firmware when link width is x4 or less
- Add hw.mxge.force_firmware tunable to allow user to force
  selection of aligned (or unaligned) firmware
2006-11-22 16:33:40 +00:00
Andrew Gallatin
dc8731d4d2 Added MSI support.
Sponsored by: Myricom Inc.
2006-11-21 15:55:01 +00:00
Andrew Gallatin
b4db900931 Fix a driver bug which could result in frames MHLEN or (MHLEN - 1) bytes
long being DMA'ed 2 (or 1) bytes past the end of the mbuf and corrupting
random kernel memory.  I had forgotten about the 2 bytes of implict
padding the firmware assumes.

Sponsored by: Myricom Inc.
2006-10-17 14:39:19 +00:00
Andrew Gallatin
0fa7f68197 - Updated to the latest myri10ge firmware
- Added support for multicast filtering, now that the firmware
  supports it.  Note that this is not yet tested, as multicast
  seems to panic -current (even w/o mxge loaded)
- Added workaround to cope with different irq data struct size on
  pre-multicast firmware which can found running on nics.
- Added Intel E5000 PCIe chipsets to list providing aligned completions.
- Replaced various magic constants with #defines, now that they are
  defined in the firmware headers.
2006-09-15 19:24:45 +00:00
Andrew Gallatin
aed8e389c1 - Added TSO support. This entailed increasing the number of send descriptors
in the transmit busdma tag, so I moved the segment list off the
stack.

- Fixed transmit routine to ensure it doesn't read past the end
of an mbuf when parsing headers.

- Corrected handling of odd length segments.  Setting MXGEFW_FLAGS_ALIGN_ODD
is required only when offloading the checksum of that frame.

Sponsored by: Myricom Inc.
2006-09-15 15:41:28 +00:00
Andrew Gallatin
7d542e2d80 Copy the link-layer address from our ifnet pointer at reset time
so that the mac address can be overridden.
2006-08-04 17:58:40 +00:00
Andrew Gallatin
091feecd12 - add read only sysctl to indicate if write-combining was enabled
- enable mxge_dummy_rdma() right after reset, and make sure to disable
  when detaching the driver.
2006-08-01 14:02:54 +00:00
Andrew Gallatin
4da0d523f9 Firmware loading improvements:
- Copy ethernet firmware down in small chunks so as to avoid bugs
  in early versions of the bootstrap firmware.
- Attempt to "adopt" the running firmware if we cannot load a suitable
  firmware image via firmware(9).
- Separate firmware validation into its own routine, and check the
  major/minor driver/firmware ABI version.
2006-07-17 22:17:05 +00:00
Andrew Gallatin
6d914a32ff Much to my surprise, IFQ_DRV_DEQUEUE() can return a null mbuf even if
!IFQ_DRV_IS_EMPTY().  Taking this into account,  I re-structured the
transmit routine so as to avoid adding another if/then in the
critical path.

Thanks to brueffer for showing my how to test with altq/pf.
2006-06-14 19:32:00 +00:00
Andrew Gallatin
76bb9c5edb Replace a sc->ifp->if_snd.ifq_drv_maxlen with IFQ_SET_MAXLEN(),
and call IFQ_SET_READY().

Submitted by: brueffer
2006-06-14 17:52:30 +00:00
Andrew Gallatin
5e7d85418b Update the mxge driver.
- Update the firmware to the latest released firmware
  (1.4.3), which corresponds to the firmware in the
  latest shipping drivers from Myricom.  This firmware
  fixes several bugs in the firmware's PCI-e implementation,
  and it also changes the driver/firmware interface:

  o TSO was added, and changed the format of the transmit
    descriptors.
  o The firmware no longer counts transmits descriptors,
    but frames.  So the driver needs to keep a count
    of the number of frames sent.
  o The weird interrupt strategy changed to a normal receive
    return ring.  This ring is much bigger, and we may be
    able to support DEVICE_POLLING.
  o Myricom's header files changed the name of firmware
    related #define's and enums (s/_MCP_/FW_).

- Stopped spamming the console with lots of printfs unless
  mxge_verbose (or bootverbose) is set.

- Made additional information available via sysctl, including
  the results of a PCI-e DMA benchmark run at device reset.

- Decreased the excessively long timeouts when sending commands
  from 2 seconds to 20ms.

Sponsored by: Myricom Inc.
2006-06-14 16:23:17 +00:00
Andrew Gallatin
6d87a65da4 - Complete the myri10ge -> mxge name change by doing a mechanical
s/myri10ge/mxge/g replacement in the myri10ge files.  A few contuation
  lines were joined because of the regained columns.
- Hook the mxge driver back to the build.
2006-06-13 13:53:52 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
Andrew Gallatin
b2fc195e1b 10GbE mode driver and binary firmware for Myricom's PCI-express NICs.
More info regarding these nics can be found at http://www.myri.com.

Please note that the files
sys/dev/myri10ge/{mcp_gen_header.h,myri10ge_mcp.h} are internally
shared between all our drivers (solaris, macosx, windows, linux, etc).
I'd like to keep these files unchanged, so I can just import newer
versions of them when the firmware API/ABI changes.  This means I'm
stuck with some of the crazy-long #define names, and possibly
non-style(9) characteristics of these files.

Many thanks to mlaier for doing firmware(9) just as I
needed it, and to scottl for his helpful review.

Reviewed by: scottl, glebius
Sponsored by: Myricom Inc.
2006-02-19 22:39:19 +00:00