diff options
author | np <np@FreeBSD.org> | 2010-04-05 23:29:27 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2010-04-05 23:29:27 +0000 |
commit | b6e2225acad97acb308178b8fb03d4c99dd78190 (patch) | |
tree | 66a7ab2e753fd9b1585a248d79a55eee2329beb4 /sys | |
parent | 1cfe8f3d2a6c99ebc57067809ce56681f87bcdb4 (diff) | |
download | FreeBSD-src-b6e2225acad97acb308178b8fb03d4c99dd78190.zip FreeBSD-src-b6e2225acad97acb308178b8fb03d4c99dd78190.tar.gz |
cxgb(4) MFCs: r204271,r204274,r204348,r204921,r205944,r205945,r205946,r205947,r205948,r205949,r205950,r206109
r204271:
Accessing an mbuf after it has been handed off to the hardware is a bad
race as it could already have been tx'd and freed by that time. Place
the bpf tap just _before_ writing the gen bit.
This fixes a panic when running tcpdump on a cxgb interface.
r204274:
There is no need to test __FreeBSD_version for features that have
been around for a long time now (7.1-ish or even earlier); assume
they are present. These includes MSI, TSO, LRO, VLAN, INTR_FILTERS,
FIRMWARE, etc.
Also, eliminate some dead code and clean up in other places as part
of this quick once-over.
r204348:
Support IFCAP_VLANHWTSO in cxgb(4). It works with or without vlanhwtag.
While here, remove old DPRINTFs and tidy up the capability code a bit.
r204921:
Better TwinAx transceiver detection.
Originally submitted by: <Bruno dot Bittner at isilon dot com>
(This is a rewritten, corrected version of that patch)
r205944:
Refresh the firmware version immediately after it is upgraded (or downgraded).
r205945:
Improved PHY EDC settings.
r205946:
Do not attempt to retrieve interrupt information before it is available.
r205947:
Fix build with "nooptions INET"
r205948:
Fix tx drop statistics.
r205949:
Fix signed/unsigned mix-up that allowed txq->in_use to grow beyond txq->size.
r205950:
Multiple fixes related to queue set sizing and resources:
- Only the tunnelq (TXQ_ETH) requires a buf_ring, an ifq, and the watchdog/timer
callouts. Do not allocate these for the other tx queues.
- Use 16k jumbo clusters only on offload capable cards by default.
- Do not allocate a full tx ring for the offload queue if the card is not
offload capable.
- Slightly better freelist size calculation.
- Fix nmbjumbo4 typo, remove unneeded global variables.
r206109:
Increase response queue size to avoid starvation, add a counter
to track it when it does occur.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cxgb/common/cxgb_ael1002.c | 807 | ||||
-rw-r--r-- | sys/dev/cxgb/common/cxgb_common.h | 9 | ||||
-rw-r--r-- | sys/dev/cxgb/common/cxgb_t3_hw.c | 10 | ||||
-rw-r--r-- | sys/dev/cxgb/common/cxgb_version.h | 41 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_adapter.h | 15 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_config.h | 40 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_main.c | 237 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_offload.h | 2 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_osdep.h | 30 | ||||
-rw-r--r-- | sys/dev/cxgb/cxgb_sge.c | 248 | ||||
-rw-r--r-- | sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c | 3 | ||||
-rw-r--r-- | sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c | 1 | ||||
-rw-r--r-- | sys/modules/cxgb/cxgb/Makefile | 8 |
13 files changed, 647 insertions, 804 deletions
diff --git a/sys/dev/cxgb/common/cxgb_ael1002.c b/sys/dev/cxgb/common/cxgb_ael1002.c index ec5ffe7..fc2e140 100644 --- a/sys/dev/cxgb/common/cxgb_ael1002.c +++ b/sys/dev/cxgb/common/cxgb_ael1002.c @@ -446,7 +446,7 @@ static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms) return v; if (v == 0x1) - return phy_modtype_twinax; + goto twinax; if (v == 0x10) return phy_modtype_sr; if (v == 0x20) @@ -454,6 +454,17 @@ static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms) if (v == 0x40) return phy_modtype_lrm; + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 8); + if (v < 0) + return v; + if (v == 4) { + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 60); + if (v < 0) + return v; + if (v & 0x1) + goto twinax; + } + v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 6); if (v < 0) return v; @@ -465,6 +476,7 @@ static int ael2xxx_get_module_type(struct cphy *phy, int delay_ms) return v; if (v & 0x80) { +twinax: v = ael_i2c_rd(phy, MODULE_DEV_ADDR, 0x12); if (v < 0) return v; @@ -1435,395 +1447,439 @@ static int ael2020_setup_twinax_edc(struct cphy *phy, int modtype) 0xd803, 0x40aa, 0xd804, 0x401c, 0xd805, 0x401e, - 0xd806, 0x2ff4, - 0xd807, 0x3dc4, - 0xd808, 0x2035, - 0xd809, 0x3035, - 0xd80a, 0x6524, - 0xd80b, 0x2cb2, - 0xd80c, 0x3012, - 0xd80d, 0x1002, - 0xd80e, 0x26e2, - 0xd80f, 0x3022, - 0xd810, 0x1002, - 0xd811, 0x27d2, - 0xd812, 0x3022, + 0xd806, 0x20c5, + 0xd807, 0x3c05, + 0xd808, 0x6536, + 0xd809, 0x2fe4, + 0xd80a, 0x3dc4, + 0xd80b, 0x6624, + 0xd80c, 0x2ff4, + 0xd80d, 0x3dc4, + 0xd80e, 0x2035, + 0xd80f, 0x30a5, + 0xd810, 0x6524, + 0xd811, 0x2ca2, + 0xd812, 0x3012, 0xd813, 0x1002, - 0xd814, 0x2822, - 0xd815, 0x3012, + 0xd814, 0x27e2, + 0xd815, 0x3022, 0xd816, 0x1002, - 0xd817, 0x2492, + 0xd817, 0x28d2, 0xd818, 0x3022, 0xd819, 0x1002, - 0xd81a, 0x2772, + 0xd81a, 0x2892, 0xd81b, 0x3012, 0xd81c, 0x1002, - 0xd81d, 0x23d2, + 0xd81d, 0x24e2, 0xd81e, 0x3022, 0xd81f, 0x1002, - 0xd820, 0x22cd, - 0xd821, 0x301d, - 0xd822, 0x27f2, - 0xd823, 0x3022, - 0xd824, 0x1002, - 0xd825, 0x5553, - 0xd826, 0x0307, - 0xd827, 0x2522, - 0xd828, 0x3022, - 0xd829, 0x1002, - 0xd82a, 0x2142, - 0xd82b, 0x3012, - 0xd82c, 0x1002, - 0xd82d, 0x4016, - 0xd82e, 0x5e63, - 0xd82f, 0x0344, - 0xd830, 0x2142, + 0xd820, 0x27e2, + 0xd821, 0x3012, + 0xd822, 0x1002, + 0xd823, 0x2422, + 0xd824, 0x3022, + 0xd825, 0x1002, + 0xd826, 0x22cd, + 0xd827, 0x301d, + 0xd828, 0x28f2, + 0xd829, 0x3022, + 0xd82a, 0x1002, + 0xd82b, 0x5553, + 0xd82c, 0x0307, + 0xd82d, 0x2572, + 0xd82e, 0x3022, + 0xd82f, 0x1002, + 0xd830, 0x21a2, 0xd831, 0x3012, 0xd832, 0x1002, - 0xd833, 0x400e, - 0xd834, 0x2522, - 0xd835, 0x3022, - 0xd836, 0x1002, - 0xd837, 0x2b52, - 0xd838, 0x3012, - 0xd839, 0x1002, - 0xd83a, 0x2742, + 0xd833, 0x4016, + 0xd834, 0x5e63, + 0xd835, 0x0344, + 0xd836, 0x21a2, + 0xd837, 0x3012, + 0xd838, 0x1002, + 0xd839, 0x400e, + 0xd83a, 0x2572, 0xd83b, 0x3022, 0xd83c, 0x1002, - 0xd83d, 0x25e2, - 0xd83e, 0x3022, + 0xd83d, 0x2b22, + 0xd83e, 0x3012, 0xd83f, 0x1002, - 0xd840, 0x2fa4, - 0xd841, 0x3dc4, - 0xd842, 0x6624, - 0xd843, 0x414b, - 0xd844, 0x56b3, - 0xd845, 0x03c6, - 0xd846, 0x866b, - 0xd847, 0x400c, - 0xd848, 0x2712, - 0xd849, 0x3012, - 0xd84a, 0x1002, - 0xd84b, 0x2c4b, - 0xd84c, 0x309b, - 0xd84d, 0x56b3, - 0xd84e, 0x03c3, - 0xd84f, 0x866b, - 0xd850, 0x400c, - 0xd851, 0x2272, - 0xd852, 0x3022, - 0xd853, 0x1002, - 0xd854, 0x2742, - 0xd855, 0x3022, - 0xd856, 0x1002, - 0xd857, 0x25e2, - 0xd858, 0x3022, - 0xd859, 0x1002, - 0xd85a, 0x2fb4, - 0xd85b, 0x3dc4, - 0xd85c, 0x6624, - 0xd85d, 0x56b3, - 0xd85e, 0x03c3, - 0xd85f, 0x866b, - 0xd860, 0x401c, - 0xd861, 0x2c45, - 0xd862, 0x3095, - 0xd863, 0x5b53, - 0xd864, 0x2372, - 0xd865, 0x3012, - 0xd866, 0x13c2, - 0xd867, 0x5cc3, - 0xd868, 0x2712, - 0xd869, 0x3012, - 0xd86a, 0x1312, - 0xd86b, 0x2b52, + 0xd840, 0x2842, + 0xd841, 0x3022, + 0xd842, 0x1002, + 0xd843, 0x26e2, + 0xd844, 0x3022, + 0xd845, 0x1002, + 0xd846, 0x2fa4, + 0xd847, 0x3dc4, + 0xd848, 0x6624, + 0xd849, 0x2e8b, + 0xd84a, 0x303b, + 0xd84b, 0x56b3, + 0xd84c, 0x03c6, + 0xd84d, 0x866b, + 0xd84e, 0x400c, + 0xd84f, 0x2782, + 0xd850, 0x3012, + 0xd851, 0x1002, + 0xd852, 0x2c4b, + 0xd853, 0x309b, + 0xd854, 0x56b3, + 0xd855, 0x03c3, + 0xd856, 0x866b, + 0xd857, 0x400c, + 0xd858, 0x22a2, + 0xd859, 0x3022, + 0xd85a, 0x1002, + 0xd85b, 0x2842, + 0xd85c, 0x3022, + 0xd85d, 0x1002, + 0xd85e, 0x26e2, + 0xd85f, 0x3022, + 0xd860, 0x1002, + 0xd861, 0x2fb4, + 0xd862, 0x3dc4, + 0xd863, 0x6624, + 0xd864, 0x56b3, + 0xd865, 0x03c3, + 0xd866, 0x866b, + 0xd867, 0x401c, + 0xd868, 0x2c45, + 0xd869, 0x3095, + 0xd86a, 0x5b53, + 0xd86b, 0x23d2, 0xd86c, 0x3012, - 0xd86d, 0x1002, - 0xd86e, 0x2742, - 0xd86f, 0x3022, - 0xd870, 0x1002, - 0xd871, 0x2582, - 0xd872, 0x3022, - 0xd873, 0x1002, - 0xd874, 0x2142, - 0xd875, 0x3012, - 0xd876, 0x1002, - 0xd877, 0x628f, - 0xd878, 0x2985, - 0xd879, 0x33a5, - 0xd87a, 0x25e2, - 0xd87b, 0x3022, - 0xd87c, 0x1002, - 0xd87d, 0x5653, - 0xd87e, 0x03d2, - 0xd87f, 0x401e, - 0xd880, 0x6f72, - 0xd881, 0x1002, - 0xd882, 0x628f, - 0xd883, 0x2304, - 0xd884, 0x3c84, - 0xd885, 0x6436, - 0xd886, 0xdff4, - 0xd887, 0x6436, - 0xd888, 0x2ff5, - 0xd889, 0x3005, - 0xd88a, 0x8656, - 0xd88b, 0xdfba, - 0xd88c, 0x56a3, - 0xd88d, 0xd05a, - 0xd88e, 0x2972, - 0xd88f, 0x3012, - 0xd890, 0x1392, - 0xd891, 0xd05a, - 0xd892, 0x56a3, - 0xd893, 0xdfba, - 0xd894, 0x0383, - 0xd895, 0x6f72, - 0xd896, 0x1002, - 0xd897, 0x2b45, - 0xd898, 0x3005, - 0xd899, 0x4178, - 0xd89a, 0x5653, - 0xd89b, 0x0384, - 0xd89c, 0x2a62, - 0xd89d, 0x3012, - 0xd89e, 0x1002, - 0xd89f, 0x2f05, - 0xd8a0, 0x3005, - 0xd8a1, 0x41c8, - 0xd8a2, 0x5653, - 0xd8a3, 0x0382, - 0xd8a4, 0x0002, - 0xd8a5, 0x4218, - 0xd8a6, 0x2474, - 0xd8a7, 0x3c84, - 0xd8a8, 0x6437, - 0xd8a9, 0xdff4, - 0xd8aa, 0x6437, - 0xd8ab, 0x2ff5, - 0xd8ac, 0x3c05, - 0xd8ad, 0x8757, - 0xd8ae, 0xb888, - 0xd8af, 0x9787, - 0xd8b0, 0xdff4, - 0xd8b1, 0x6724, - 0xd8b2, 0x866a, - 0xd8b3, 0x6f72, - 0xd8b4, 0x1002, - 0xd8b5, 0x2641, - 0xd8b6, 0x3021, - 0xd8b7, 0x1001, - 0xd8b8, 0xc620, - 0xd8b9, 0x0000, - 0xd8ba, 0xc621, - 0xd8bb, 0x0000, - 0xd8bc, 0xc622, - 0xd8bd, 0x00ce, - 0xd8be, 0xc623, - 0xd8bf, 0x007f, - 0xd8c0, 0xc624, - 0xd8c1, 0x0032, - 0xd8c2, 0xc625, - 0xd8c3, 0x0000, - 0xd8c4, 0xc627, - 0xd8c5, 0x0000, - 0xd8c6, 0xc628, - 0xd8c7, 0x0000, - 0xd8c8, 0xc62c, + 0xd86d, 0x13c2, + 0xd86e, 0x5cc3, + 0xd86f, 0x2782, + 0xd870, 0x3012, + 0xd871, 0x1312, + 0xd872, 0x2b22, + 0xd873, 0x3012, + 0xd874, 0x1002, + 0xd875, 0x2842, + 0xd876, 0x3022, + 0xd877, 0x1002, + 0xd878, 0x2622, + 0xd879, 0x3022, + 0xd87a, 0x1002, + 0xd87b, 0x21a2, + 0xd87c, 0x3012, + 0xd87d, 0x1002, + 0xd87e, 0x628f, + 0xd87f, 0x2985, + 0xd880, 0x33a5, + 0xd881, 0x26e2, + 0xd882, 0x3022, + 0xd883, 0x1002, + 0xd884, 0x5653, + 0xd885, 0x03d2, + 0xd886, 0x401e, + 0xd887, 0x6f72, + 0xd888, 0x1002, + 0xd889, 0x628f, + 0xd88a, 0x2304, + 0xd88b, 0x3c84, + 0xd88c, 0x6436, + 0xd88d, 0xdff4, + 0xd88e, 0x6436, + 0xd88f, 0x2ff5, + 0xd890, 0x3005, + 0xd891, 0x8656, + 0xd892, 0xdfba, + 0xd893, 0x56a3, + 0xd894, 0xd05a, + 0xd895, 0x29e2, + 0xd896, 0x3012, + 0xd897, 0x1392, + 0xd898, 0xd05a, + 0xd899, 0x56a3, + 0xd89a, 0xdfba, + 0xd89b, 0x0383, + 0xd89c, 0x6f72, + 0xd89d, 0x1002, + 0xd89e, 0x2a64, + 0xd89f, 0x3014, + 0xd8a0, 0x2005, + 0xd8a1, 0x3d75, + 0xd8a2, 0xc451, + 0xd8a3, 0x29a2, + 0xd8a4, 0x3022, + 0xd8a5, 0x1002, + 0xd8a6, 0x178c, + 0xd8a7, 0x1898, + 0xd8a8, 0x19a4, + 0xd8a9, 0x1ab0, + 0xd8aa, 0x1bbc, + 0xd8ab, 0x1cc8, + 0xd8ac, 0x1dd3, + 0xd8ad, 0x1ede, + 0xd8ae, 0x1fe9, + 0xd8af, 0x20f4, + 0xd8b0, 0x21ff, + 0xd8b1, 0x0000, + 0xd8b2, 0x2741, + 0xd8b3, 0x3021, + 0xd8b4, 0x1001, + 0xd8b5, 0xc620, + 0xd8b6, 0x0000, + 0xd8b7, 0xc621, + 0xd8b8, 0x0000, + 0xd8b9, 0xc622, + 0xd8ba, 0x00e2, + 0xd8bb, 0xc623, + 0xd8bc, 0x007f, + 0xd8bd, 0xc624, + 0xd8be, 0x00ce, + 0xd8bf, 0xc625, + 0xd8c0, 0x0000, + 0xd8c1, 0xc627, + 0xd8c2, 0x0000, + 0xd8c3, 0xc628, + 0xd8c4, 0x0000, + 0xd8c5, 0xc90a, + 0xd8c6, 0x3a7c, + 0xd8c7, 0xc62c, + 0xd8c8, 0x0000, 0xd8c9, 0x0000, - 0xd8ca, 0x0000, - 0xd8cb, 0x2641, - 0xd8cc, 0x3021, - 0xd8cd, 0x1001, - 0xd8ce, 0xc502, - 0xd8cf, 0x53ac, - 0xd8d0, 0xc503, - 0xd8d1, 0x2cd3, - 0xd8d2, 0xc600, - 0xd8d3, 0x2a6e, - 0xd8d4, 0xc601, - 0xd8d5, 0x2a2c, - 0xd8d6, 0xc605, - 0xd8d7, 0x5557, - 0xd8d8, 0xc60c, - 0xd8d9, 0x5400, - 0xd8da, 0xc710, - 0xd8db, 0x0700, - 0xd8dc, 0xc711, - 0xd8dd, 0x0f06, - 0xd8de, 0xc718, - 0xd8df, 0x0700, - 0xd8e0, 0xc719, - 0xd8e1, 0x0f06, - 0xd8e2, 0xc720, - 0xd8e3, 0x4700, - 0xd8e4, 0xc721, - 0xd8e5, 0x0f06, - 0xd8e6, 0xc728, - 0xd8e7, 0x0700, - 0xd8e8, 0xc729, - 0xd8e9, 0x1207, - 0xd8ea, 0xc801, - 0xd8eb, 0x7f50, - 0xd8ec, 0xc802, - 0xd8ed, 0x7760, - 0xd8ee, 0xc803, - 0xd8ef, 0x7fce, - 0xd8f0, 0xc804, - 0xd8f1, 0x520e, - 0xd8f2, 0xc805, - 0xd8f3, 0x5c11, - 0xd8f4, 0xc806, - 0xd8f5, 0x3c51, - 0xd8f6, 0xc807, - 0xd8f7, 0x4061, - 0xd8f8, 0xc808, - 0xd8f9, 0x49c1, - 0xd8fa, 0xc809, - 0xd8fb, 0x3840, - 0xd8fc, 0xc80a, - 0xd8fd, 0x0000, - 0xd8fe, 0xc821, - 0xd8ff, 0x0002, - 0xd900, 0xc822, - 0xd901, 0x0046, - 0xd902, 0xc844, - 0xd903, 0x182f, - 0xd904, 0xc013, - 0xd905, 0xf341, - 0xd906, 0xc084, - 0xd907, 0x0030, - 0xd908, 0xc904, - 0xd909, 0x1401, - 0xd90a, 0xcb0c, - 0xd90b, 0x0004, - 0xd90c, 0xcb0e, - 0xd90d, 0xa00a, - 0xd90e, 0xcb0f, - 0xd90f, 0xc0c0, - 0xd910, 0xcb10, - 0xd911, 0xc0c0, - 0xd912, 0xcb11, - 0xd913, 0x00a0, - 0xd914, 0xcb12, - 0xd915, 0x0007, - 0xd916, 0xc241, - 0xd917, 0xa000, - 0xd918, 0xc243, - 0xd919, 0x7fe0, - 0xd91a, 0xc604, - 0xd91b, 0x000e, - 0xd91c, 0xc609, - 0xd91d, 0x00f5, - 0xd91e, 0xc611, - 0xd91f, 0x000e, - 0xd920, 0xc660, - 0xd921, 0x9600, - 0xd922, 0xc687, - 0xd923, 0x0004, - 0xd924, 0xc60a, - 0xd925, 0x04f5, - 0xd926, 0x0000, - 0xd927, 0x2641, - 0xd928, 0x3021, - 0xd929, 0x1001, - 0xd92a, 0xc620, - 0xd92b, 0x14e5, - 0xd92c, 0xc621, - 0xd92d, 0xc53d, - 0xd92e, 0xc622, - 0xd92f, 0x3cbe, - 0xd930, 0xc623, - 0xd931, 0x4452, - 0xd932, 0xc624, - 0xd933, 0xc5c5, - 0xd934, 0xc625, - 0xd935, 0xe01e, - 0xd936, 0xc627, - 0xd937, 0x0000, - 0xd938, 0xc628, - 0xd939, 0x0000, - 0xd93a, 0xc62c, - 0xd93b, 0x0000, + 0xd8ca, 0x2741, + 0xd8cb, 0x3021, + 0xd8cc, 0x1001, + 0xd8cd, 0xc502, + 0xd8ce, 0x53ac, + 0xd8cf, 0xc503, + 0xd8d0, 0x2cd3, + 0xd8d1, 0xc600, + 0xd8d2, 0x2a6e, + 0xd8d3, 0xc601, + 0xd8d4, 0x2a2c, + 0xd8d5, 0xc605, + 0xd8d6, 0x5557, + 0xd8d7, 0xc60c, + 0xd8d8, 0x5400, + 0xd8d9, 0xc710, + 0xd8da, 0x0700, + 0xd8db, 0xc711, + 0xd8dc, 0x0f06, + 0xd8dd, 0xc718, + 0xd8de, 0x700, + 0xd8df, 0xc719, + 0xd8e0, 0x0f06, + 0xd8e1, 0xc720, + 0xd8e2, 0x4700, + 0xd8e3, 0xc721, + 0xd8e4, 0x0f06, + 0xd8e5, 0xc728, + 0xd8e6, 0x0700, + 0xd8e7, 0xc729, + 0xd8e8, 0x1207, + 0xd8e9, 0xc801, + 0xd8ea, 0x7f50, + 0xd8eb, 0xc802, + 0xd8ec, 0x7760, + 0xd8ed, 0xc803, + 0xd8ee, 0x7fce, + 0xd8ef, 0xc804, + 0xd8f0, 0x520e, + 0xd8f1, 0xc805, + 0xd8f2, 0x5c11, + 0xd8f3, 0xc806, + 0xd8f4, 0x3c51, + 0xd8f5, 0xc807, + 0xd8f6, 0x4061, + 0xd8f7, 0xc808, + 0xd8f8, 0x49c1, + 0xd8f9, 0xc809, + 0xd8fa, 0x3840, + 0xd8fb, 0xc80a, + 0xd8fc, 0x0000, + 0xd8fd, 0xc821, + 0xd8fe, 0x0002, + 0xd8ff, 0xc822, + 0xd900, 0x0046, + 0xd901, 0xc844, + 0xd902, 0x182f, + 0xd903, 0xc849, + 0xd904, 0x0400, + 0xd905, 0xc84a, + 0xd906, 0x0002, + 0xd907, 0xc013, + 0xd908, 0xf341, + 0xd909, 0xc084, + 0xd90a, 0x0030, + 0xd90b, 0xc904, + 0xd90c, 0x1401, + 0xd90d, 0xcb0c, + 0xd90e, 0x0004, + 0xd90f, 0xcb0e, + 0xd910, 0xa00a, + 0xd911, 0xcb0f, + 0xd912, 0xc0c0, + 0xd913, 0xcb10, + 0xd914, 0xc0c0, + 0xd915, 0xcb11, + 0xd916, 0x00a0, + 0xd917, 0xcb12, + 0xd918, 0x0007, + 0xd919, 0xc241, + 0xd91a, 0xa000, + 0xd91b, 0xc243, + 0xd91c, 0x7fe0, + 0xd91d, 0xc604, + 0xd91e, 0x000e, + 0xd91f, 0xc609, + 0xd920, 0x00f5, + 0xd921, 0xc611, + 0xd922, 0x000e, + 0xd923, 0xc660, + 0xd924, 0x9600, + 0xd925, 0xc687, + 0xd926, 0x0004, + 0xd927, 0xc60a, + 0xd928, 0x04f5, + 0xd929, 0x0000, + 0xd92a, 0x2741, + 0xd92b, 0x3021, + 0xd92c, 0x1001, + 0xd92d, 0xc620, + 0xd92e, 0x14e5, + 0xd92f, 0xc621, + 0xd930, 0xc53d, + 0xd931, 0xc622, + 0xd932, 0x3cbe, + 0xd933, 0xc623, + 0xd934, 0x4452, + 0xd935, 0xc624, + 0xd936, 0xc5c5, + 0xd937, 0xc625, + 0xd938, 0xe01e, + 0xd939, 0xc627, + 0xd93a, 0x0000, + 0xd93b, 0xc628, 0xd93c, 0x0000, - 0xd93d, 0x2b84, - 0xd93e, 0x3c74, - 0xd93f, 0x6435, - 0xd940, 0xdff4, - 0xd941, 0x6435, - 0xd942, 0x2806, - 0xd943, 0x3006, - 0xd944, 0x8565, - 0xd945, 0x2b24, - 0xd946, 0x3c24, - 0xd947, 0x6436, - 0xd948, 0x1002, - 0xd949, 0x2b24, - 0xd94a, 0x3c24, - 0xd94b, 0x6436, - 0xd94c, 0x4045, - 0xd94d, 0x8656, - 0xd94e, 0x5663, - 0xd94f, 0x0302, - 0xd950, 0x401e, - 0xd951, 0x1002, - 0xd952, 0x2807, - 0xd953, 0x31a7, - 0xd954, 0x20c4, - 0xd955, 0x3c24, - 0xd956, 0x6724, - 0xd957, 0x1002, - 0xd958, 0x2807, - 0xd959, 0x3187, - 0xd95a, 0x20c4, - 0xd95b, 0x3c24, - 0xd95c, 0x6724, - 0xd95d, 0x1002, - 0xd95e, 0x24f4, - 0xd95f, 0x3c64, - 0xd960, 0x6436, - 0xd961, 0xdff4, - 0xd962, 0x6436, - 0xd963, 0x1002, - 0xd964, 0x2006, - 0xd965, 0x3d76, - 0xd966, 0xc161, - 0xd967, 0x6134, - 0xd968, 0x6135, - 0xd969, 0x5443, - 0xd96a, 0x0303, - 0xd96b, 0x6524, - 0xd96c, 0x00fb, + 0xd93d, 0xc62c, + 0xd93e, 0x0000, + 0xd93f, 0xc90a, + 0xd940, 0x3a7c, + 0xd941, 0x0000, + 0xd942, 0x2b84, + 0xd943, 0x3c74, + 0xd944, 0x6435, + 0xd945, 0xdff4, + 0xd946, 0x6435, + 0xd947, 0x2806, + 0xd948, 0x3006, + 0xd949, 0x8565, + 0xd94a, 0x2b24, + 0xd94b, 0x3c24, + 0xd94c, 0x6436, + 0xd94d, 0x1002, + 0xd94e, 0x2b24, + 0xd94f, 0x3c24, + 0xd950, 0x6436, + 0xd951, 0x4045, + 0xd952, 0x8656, + 0xd953, 0x5663, + 0xd954, 0x0302, + 0xd955, 0x401e, + 0xd956, 0x1002, + 0xd957, 0x2807, + 0xd958, 0x31a7, + 0xd959, 0x20c4, + 0xd95a, 0x3c24, + 0xd95b, 0x6724, + 0xd95c, 0x2ff7, + 0xd95d, 0x30f7, + 0xd95e, 0x20c4, + 0xd95f, 0x3c04, + 0xd960, 0x6724, + 0xd961, 0x1002, + 0xd962, 0x2807, + 0xd963, 0x3187, + 0xd964, 0x20c4, + 0xd965, 0x3c24, + 0xd966, 0x6724, + 0xd967, 0x2fe4, + 0xd968, 0x3dc4, + 0xd969, 0x6437, + 0xd96a, 0x20c4, + 0xd96b, 0x3c04, + 0xd96c, 0x6724, 0xd96d, 0x1002, - 0xd96e, 0x20d4, - 0xd96f, 0x3c24, - 0xd970, 0x2025, - 0xd971, 0x3005, - 0xd972, 0x6524, + 0xd96e, 0x24f4, + 0xd96f, 0x3c64, + 0xd970, 0x6436, + 0xd971, 0xdff4, + 0xd972, 0x6436, 0xd973, 0x1002, - 0xd974, 0xd019, - 0xd975, 0x2104, - 0xd976, 0x3c24, - 0xd977, 0x2105, - 0xd978, 0x3805, - 0xd979, 0x6524, - 0xd97a, 0xdff4, - 0xd97b, 0x4005, - 0xd97c, 0x6524, - 0xd97d, 0x2e8d, - 0xd97e, 0x303d, - 0xd97f, 0x2408, - 0xd980, 0x35d8, - 0xd981, 0x5dd3, - 0xd982, 0x0307, - 0xd983, 0x8887, - 0xd984, 0x63a7, - 0xd985, 0x8887, - 0xd986, 0x63a7, - 0xd987, 0xdffd, - 0xd988, 0x00f9, - 0xd989, 0x1002, - 0xd98a, 0x0000, + 0xd974, 0x2006, + 0xd975, 0x3d76, + 0xd976, 0xc161, + 0xd977, 0x6134, + 0xd978, 0x6135, + 0xd979, 0x5443, + 0xd97a, 0x0303, + 0xd97b, 0x6524, + 0xd97c, 0x00fb, + 0xd97d, 0x1002, + 0xd97e, 0x20d4, + 0xd97f, 0x3c24, + 0xd980, 0x2025, + 0xd981, 0x3005, + 0xd982, 0x6524, + 0xd983, 0x1002, + 0xd984, 0xd019, + 0xd985, 0x2104, + 0xd986, 0x3c24, + 0xd987, 0x2105, + 0xd988, 0x3805, + 0xd989, 0x6524, + 0xd98a, 0xdff4, + 0xd98b, 0x4005, + 0xd98c, 0x6524, + 0xd98d, 0x2e8d, + 0xd98e, 0x303d, + 0xd98f, 0x2408, + 0xd990, 0x35d8, + 0xd991, 0x5dd3, + 0xd992, 0x0307, + 0xd993, 0x8887, + 0xd994, 0x63a7, + 0xd995, 0x8887, + 0xd996, 0x63a7, + 0xd997, 0xdffd, + 0xd998, 0x00f9, + 0xd999, 0x1002, + 0xd99a, 0x866a, + 0xd99b, 0x6138, + 0xd99c, 0x5883, + 0xd99d, 0x2aa2, + 0xd99e, 0x3022, + 0xd99f, 0x1302, + 0xd9a0, 0x2ff7, + 0xd9a1, 0x3007, + 0xd9a2, 0x8785, + 0xd9a3, 0xb887, + 0xd9a4, 0x8786, + 0xd9a5, 0xb8c6, + 0xd9a6, 0x5a53, + 0xd9a7, 0x29b2, + 0xd9a8, 0x3022, + 0xd9a9, 0x13c2, + 0xd9aa, 0x2474, + 0xd9ab, 0x3c84, + 0xd9ac, 0x64d7, + 0xd9ad, 0x64d7, + 0xd9ae, 0x2ff5, + 0xd9af, 0x3c05, + 0xd9b0, 0x8757, + 0xd9b1, 0xb886, + 0xd9b2, 0x9767, + 0xd9b3, 0x67c4, + 0xd9b4, 0x6f72, + 0xd9b5, 0x1002, + 0xd9b6, 0x0000, }; int i, err; @@ -1944,10 +2000,14 @@ static struct reg_val ael2020_reset_regs[] = { { MDIO_DEV_PMA_PMD, 0xcd40, 0xffff, 0x0001 }, + { MDIO_DEV_PMA_PMD, 0xca12, 0xffff, 0x0100 }, + { MDIO_DEV_PMA_PMD, 0xca22, 0xffff, 0x0100 }, + { MDIO_DEV_PMA_PMD, 0xca42, 0xffff, 0x0100 }, { MDIO_DEV_PMA_PMD, 0xff02, 0xffff, 0x0023 }, { MDIO_DEV_PMA_PMD, 0xff03, 0xffff, 0x0000 }, { MDIO_DEV_PMA_PMD, 0xff04, 0xffff, 0x0000 }, + { MDIO_DEV_PMA_PMD, 0xc20d, 0xffff, 0x0002 }, /* end */ { 0, 0, 0, 0 } }; @@ -1975,6 +2035,7 @@ static int ael2020_reset(struct cphy *phy, int wait) err = set_phy_regs(phy, ael2020_reset_regs); if (err) return err; + msleep(100); /* determine module type and perform appropriate initialization */ err = ael2020_get_module_type(phy, 0); @@ -2079,6 +2140,8 @@ int t3_ael2020_phy_prep(pinfo_t *pinfo, int phy_addr, err = set_phy_regs(phy, ael2020_reset_regs); if (err) return err; + msleep(100); + err = ael2020_get_module_type(phy, 0); if (err >= 0) phy->modtype = err; diff --git a/sys/dev/cxgb/common/cxgb_common.h b/sys/dev/cxgb/common/cxgb_common.h index 2f55e9f..d523a1a 100644 --- a/sys/dev/cxgb/common/cxgb_common.h +++ b/sys/dev/cxgb/common/cxgb_common.h @@ -314,6 +314,7 @@ struct qset_params { /* SGE queue set parameters */ unsigned int rspq_size; /* # of entries in response queue */ unsigned int fl_size; /* # of entries in regular free list */ unsigned int jumbo_size; /* # of entries in jumbo free list */ + unsigned int jumbo_buf_size; /* buffer size of jumbo entry */ unsigned int txq_size[SGE_TXQ_PER_SET]; /* Tx queue sizes */ unsigned int cong_thres; /* FL congestion threshold */ unsigned int vector; /* Interrupt (line or vector) number */ @@ -392,11 +393,9 @@ struct adapter_params { const struct adapter_info *info; -#ifdef CONFIG_CHELSIO_T3_CORE unsigned short mtus[NMTUS]; unsigned short a_wnd[NCCTRL_WIN]; unsigned short b_wnd[NCCTRL_WIN]; -#endif unsigned int nports; /* # of ethernet ports */ unsigned int chan_map; /* bitmap of in-use Tx channels */ unsigned int stats_update_period; /* MAC stats accumulation period */ @@ -650,11 +649,7 @@ static inline int is_10G(const adapter_t *adap) static inline int is_offload(const adapter_t *adap) { -#if defined(CONFIG_CHELSIO_T3_CORE) return adap->params.offload; -#else - return 0; -#endif } static inline unsigned int core_ticks_per_usec(const adapter_t *adap) @@ -772,7 +767,6 @@ void t3_mc5_intr_handler(struct mc5 *mc5); int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, u32 *buf); -#ifdef CONFIG_CHELSIO_T3_CORE int t3_tp_set_coalescing_size(adapter_t *adap, unsigned int size, int psh); void t3_tp_set_max_rxsize(adapter_t *adap, unsigned int size); void t3_tp_get_mib_stats(adapter_t *adap, struct tp_mib_stats *tps); @@ -793,7 +787,6 @@ void t3_get_tx_sched(adapter_t *adap, unsigned int sched, unsigned int *kbps, void t3_read_pace_tbl(adapter_t *adap, unsigned int pace_vals[NTX_SCHED]); void t3_set_pace_tbl(adapter_t *adap, unsigned int *pace_vals, unsigned int start, unsigned int n); -#endif int t3_get_up_la(adapter_t *adapter, u32 *stopped, u32 *index, u32 *size, void *data); diff --git a/sys/dev/cxgb/common/cxgb_t3_hw.c b/sys/dev/cxgb/common/cxgb_t3_hw.c index 2c205ec..4c28a04 100644 --- a/sys/dev/cxgb/common/cxgb_t3_hw.c +++ b/sys/dev/cxgb/common/cxgb_t3_hw.c @@ -3263,7 +3263,6 @@ static void tp_set_timers(adapter_t *adap, unsigned int core_clk) #undef SECONDS } -#ifdef CONFIG_CHELSIO_T3_CORE /** * t3_tp_set_coalescing_size - set receive coalescing size * @adap: the adapter @@ -3566,7 +3565,6 @@ int t3_set_proto_sram(adapter_t *adap, const u8 *data) } return 0; } -#endif /** * t3_config_trace_filter - configure one of the tracing filters @@ -4150,14 +4148,12 @@ int t3_init_hw(adapter_t *adapter, u32 fw_params) if (tp_init(adapter, &adapter->params.tp)) goto out_err; -#ifdef CONFIG_CHELSIO_T3_CORE t3_tp_set_coalescing_size(adapter, min(adapter->params.sge.max_pkt_size, MAX_RX_COALESCING_LEN), 1); t3_tp_set_max_rxsize(adapter, min(adapter->params.sge.max_pkt_size, 16384U)); ulp_config(adapter, &adapter->params.tp); -#endif if (is_pcie(adapter)) config_pcie(adapter); else @@ -4471,8 +4467,6 @@ int __devinit t3_prep_adapter(adapter_t *adapter, if (reset && t3_reset_adapter(adapter)) return -1; - t3_sge_prep(adapter, &adapter->params.sge); - if (adapter->params.vpd.mclk) { struct tp_params *p = &adapter->params.tp; @@ -4501,6 +4495,8 @@ int __devinit t3_prep_adapter(adapter_t *adapter, t3_mc7_size(&adapter->pmtx) && t3_mc7_size(&adapter->cm); + t3_sge_prep(adapter, &adapter->params.sge); + if (is_offload(adapter)) { adapter->params.mc5.nservers = DEFAULT_NSERVERS; /* PR 6487. TOE and filtering are mutually exclusive */ @@ -4508,10 +4504,8 @@ int __devinit t3_prep_adapter(adapter_t *adapter, adapter->params.mc5.nroutes = 0; t3_mc5_prep(adapter, &adapter->mc5, MC5_MODE_144_BIT); -#ifdef CONFIG_CHELSIO_T3_CORE init_mtus(adapter->params.mtus); init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd); -#endif } early_hw_init(adapter, ai); diff --git a/sys/dev/cxgb/common/cxgb_version.h b/sys/dev/cxgb/common/cxgb_version.h deleted file mode 100644 index 3f4a652..0000000 --- a/sys/dev/cxgb/common/cxgb_version.h +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************** - -Copyright (c) 2007-2008, Chelsio Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Neither the name of the Chelsio Corporation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -$FreeBSD$ - -***************************************************************************/ -/* - * Note that although this driver doesn't contain all of the functionality of the Linux driver - * the common code is 99% the same. Hence we keep the same version number to indicate what linux - * driver the common code corresponds to. - */ -#ifndef __CHELSIO_VERSION_H -#define __CHELSIO_VERSION_H -#define DRV_DESC "Chelsio T3 Network Driver" -#define DRV_NAME "cxgb" -#define DRV_VERSION "1.0.133" -#endif diff --git a/sys/dev/cxgb/cxgb_adapter.h b/sys/dev/cxgb/cxgb_adapter.h index c5b366b..d1f5ef6 100644 --- a/sys/dev/cxgb/cxgb_adapter.h +++ b/sys/dev/cxgb/cxgb_adapter.h @@ -46,6 +46,7 @@ $FreeBSD$ #include <net/if.h> #include <net/if_media.h> #include <net/if_dl.h> +#include <netinet/tcp_lro.h> #include <machine/bus.h> #include <machine/resource.h> @@ -58,10 +59,6 @@ $FreeBSD$ #include <t3cdev.h> #include <sys/mbufq.h> -#ifdef LRO_SUPPORTED -#include <netinet/tcp_lro.h> -#endif - struct adapter; struct sge_qset; extern int cxgb_debug; @@ -142,8 +139,10 @@ enum { #define FL_Q_SIZE 4096 #define JUMBO_Q_SIZE 1024 -#define RSPQ_Q_SIZE 1024 +#define RSPQ_Q_SIZE 2048 #define TX_ETH_Q_SIZE 1024 +#define TX_OFLD_Q_SIZE 1024 +#define TX_CTRL_Q_SIZE 256 enum { TXQ_ETH = 0, TXQ_OFLD = 1, @@ -156,12 +155,10 @@ enum { TXQ_ETH = 0, #define WR_LEN (WR_FLITS * 8) #define PIO_LEN (WR_LEN - sizeof(struct cpl_tx_pkt_lso)) -#ifdef LRO_SUPPORTED struct lro_state { unsigned short enabled; struct lro_ctrl ctrl; }; -#endif #define RX_BUNDLE_SIZE 8 @@ -182,6 +179,7 @@ struct sge_rspq { uint32_t offload_bundles; uint32_t pure_rsps; uint32_t unhandled_irqs; + uint32_t starved; bus_addr_t phys_addr; bus_dma_tag_t desc_tag; @@ -253,7 +251,6 @@ struct sge_txq { struct callout txq_timer; struct callout txq_watchdog; uint64_t txq_coalesced; - uint32_t txq_drops; uint32_t txq_skipped; uint32_t txq_enqueued; uint32_t txq_dump_start; @@ -284,9 +281,7 @@ enum { struct sge_qset { struct sge_rspq rspq; struct sge_fl fl[SGE_RXQ_PER_SET]; -#ifdef LRO_SUPPORTED struct lro_state lro; -#endif struct sge_txq txq[SGE_TXQ_PER_SET]; uint32_t txq_stopped; /* which Tx queues are stopped */ uint64_t port_stats[SGE_PSTAT_MAX]; diff --git a/sys/dev/cxgb/cxgb_config.h b/sys/dev/cxgb/cxgb_config.h deleted file mode 100644 index 79af94c..0000000 --- a/sys/dev/cxgb/cxgb_config.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - -Copyright (c) 2007-2008, Chelsio Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Neither the name of the Chelsio Corporation nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - -$FreeBSD$ - -***************************************************************************/ -#ifndef _CXGB_CONFIG_H_ -#define _CXGB_CONFIG_H_ - -#define CONFIG_CHELSIO_T3_CORE - -#if __FreeBSD_version > 800053 -#define IFNET_MULTIQUEUE -#endif -#endif diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index 59e7fec..cecec14 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -218,9 +218,9 @@ TUNABLE_INT("hw.cxgb.force_fw_update", &force_fw_update); SYSCTL_UINT(_hw_cxgb, OID_AUTO, force_fw_update, CTLFLAG_RDTUN, &force_fw_update, 0, "update firmware even if up to date"); -int cxgb_use_16k_clusters = 1; +int cxgb_use_16k_clusters = -1; TUNABLE_INT("hw.cxgb.use_16k_clusters", &cxgb_use_16k_clusters); -SYSCTL_UINT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN, +SYSCTL_INT(_hw_cxgb, OID_AUTO, use_16k_clusters, CTLFLAG_RDTUN, &cxgb_use_16k_clusters, 0, "use 16kB clusters for the jumbo queue "); /* @@ -376,22 +376,27 @@ cxgb_controller_probe(device_t dev) static int upgrade_fw(adapter_t *sc) { -#ifdef FIRMWARE_LATEST const struct firmware *fw; -#else - struct firmware *fw; -#endif int status; + u32 vers; if ((fw = firmware_get(FW_FNAME)) == NULL) { device_printf(sc->dev, "Could not find firmware image %s\n", FW_FNAME); return (ENOENT); } else - device_printf(sc->dev, "updating firmware on card\n"); + device_printf(sc->dev, "installing firmware on card\n"); status = t3_load_fw(sc, (const uint8_t *)fw->data, fw->datasize); - device_printf(sc->dev, "firmware update returned %s %d\n", (status == 0) ? "success" : "fail", status); - + if (status != 0) { + device_printf(sc->dev, "failed to install firmware: %d\n", + status); + } else { + t3_get_fw_version(sc, &vers); + snprintf(&sc->fw_version[0], sizeof(sc->fw_version), "%d.%d.%d", + G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), + G_FW_VERSION_MICRO(vers)); + } + firmware_put(fw, FIRMWARE_UNLOAD); return (status); @@ -432,9 +437,7 @@ cxgb_controller_attach(device_t dev) int i, error = 0; uint32_t vers; int port_qsets = 1; -#ifdef MSI_SUPPORTED int msi_needed, reg; -#endif char buf[80]; sc = device_get_softc(dev); @@ -442,10 +445,6 @@ cxgb_controller_attach(device_t dev) sc->msi_count = 0; ai = cxgb_get_adapter_info(dev); - /* - * XXX not really related but a recent addition - */ -#ifdef MSI_SUPPORTED /* find the PCIe link width and set max read request to 4KB*/ if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { uint16_t lnk, pectl; @@ -463,7 +462,7 @@ cxgb_controller_attach(device_t dev) "PCIe x%d Link, expect reduced performance\n", sc->link_width); } -#endif + touch_bars(dev); pci_enable_busmaster(dev); /* @@ -518,8 +517,6 @@ cxgb_controller_attach(device_t dev) * back to MSI. If that fails, then try falling back to the legacy * interrupt pin model. */ -#ifdef MSI_SUPPORTED - sc->msix_regs_rid = 0x20; if ((msi_allowed >= 2) && (sc->msix_regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -565,20 +562,14 @@ cxgb_controller_attach(device_t dev) device_printf(dev, "using MSI interrupts\n"); } } -#endif if (sc->msi_count == 0) { device_printf(dev, "using line interrupts\n"); sc->cxgb_intr = t3b_intr; } /* Create a private taskqueue thread for handling driver events */ -#ifdef TASKQUEUE_CURRENT sc->tq = taskqueue_create("cxgb_taskq", M_NOWAIT, taskqueue_thread_enqueue, &sc->tq); -#else - sc->tq = taskqueue_create_fast("cxgb_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &sc->tq); -#endif if (sc->tq == NULL) { device_printf(dev, "failed to allocate controller task queue\n"); goto out; @@ -764,7 +755,6 @@ cxgb_free(struct adapter *sc) * Release all interrupt resources. */ cxgb_teardown_interrupts(sc); -#ifdef MSI_SUPPORTED if (sc->flags & (USING_MSI | USING_MSIX)) { device_printf(sc->dev, "releasing msi message(s)\n"); pci_release_msi(sc->dev); @@ -776,7 +766,6 @@ cxgb_free(struct adapter *sc) bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->msix_regs_rid, sc->msix_regs_res); } -#endif /* * Free the adapter's taskqueue. @@ -910,11 +899,8 @@ cxgb_setup_interrupts(adapter_t *sc) sc->irq_rid = 0; } else { err = bus_setup_intr(sc->dev, sc->irq_res, - INTR_MPSAFE | INTR_TYPE_NET, -#ifdef INTR_FILTERS - NULL, -#endif - sc->cxgb_intr, sc, &sc->intr_tag); + INTR_MPSAFE | INTR_TYPE_NET, NULL, + sc->cxgb_intr, sc, &sc->intr_tag); if (err) { device_printf(sc->dev, @@ -943,10 +929,7 @@ cxgb_setup_interrupts(adapter_t *sc) } err = bus_setup_intr(sc->dev, res, INTR_MPSAFE | INTR_TYPE_NET, -#ifdef INTR_FILTERS - NULL, -#endif - t3_intr_msix, &sc->sge.qs[i], &tag); + NULL, t3_intr_msix, &sc->sge.qs[i], &tag); if (err) { device_printf(sc->dev, "Cannot set up interrupt " "for message %d (%d)\n", rid, err); @@ -996,26 +979,10 @@ cxgb_makedev(struct port_info *pi) return (0); } -#ifndef LRO_SUPPORTED -#ifdef IFCAP_LRO -#undef IFCAP_LRO -#endif -#define IFCAP_LRO 0x0 -#endif - -#ifdef TSO_SUPPORTED -#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO) -/* Don't enable TSO6 yet */ -#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM | IFCAP_TSO4 | IFCAP_JUMBO_MTU | IFCAP_LRO) -#else -#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU) -/* Don't enable TSO6 yet */ -#define CXGB_CAP_ENABLE (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU) -#define IFCAP_TSO4 0x0 -#define IFCAP_TSO6 0x0 -#define CSUM_TSO 0x0 -#endif - +#define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \ + IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \ + IFCAP_VLAN_HWTSO) +#define CXGB_CAP_ENABLE (CXGB_CAP & ~IFCAP_TSO6) static int cxgb_port_attach(device_t dev) @@ -1024,8 +991,7 @@ cxgb_port_attach(device_t dev) struct ifnet *ifp; int err; struct adapter *sc; - - + p = device_get_softc(dev); sc = p->adapter; snprintf(p->lockbuf, PORT_NAME_LEN, "cxgb port lock %d:%d", @@ -1039,9 +1005,6 @@ cxgb_port_attach(device_t dev) return (ENOMEM); } - /* - * Note that there is currently no watchdog timer. - */ if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_init = cxgb_init; ifp->if_softc = p; @@ -1057,16 +1020,16 @@ cxgb_port_attach(device_t dev) IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); - ifp->if_hwassist = ifp->if_capabilities = ifp->if_capenable = 0; - ifp->if_capabilities |= CXGB_CAP; - ifp->if_capenable |= CXGB_CAP_ENABLE; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO); + ifp->if_capabilities = CXGB_CAP; + ifp->if_capenable = CXGB_CAP_ENABLE; + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO; + /* - * disable TSO on 4-port - it isn't supported by the firmware yet + * Disable TSO on 4-port - it isn't supported by the firmware. */ - if (p->adapter->params.nports > 2) { - ifp->if_capabilities &= ~(IFCAP_TSO4 | IFCAP_TSO6); - ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TSO6); + if (sc->params.nports > 2) { + ifp->if_capabilities &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); + ifp->if_capenable &= ~(IFCAP_TSO | IFCAP_VLAN_HWTSO); ifp->if_hwassist &= ~CSUM_TSO; } @@ -1074,11 +1037,10 @@ cxgb_port_attach(device_t dev) ifp->if_transmit = cxgb_transmit; ifp->if_qflush = cxgb_qflush; - /* - * Only default to jumbo frames on 10GigE - */ - if (p->adapter->params.nports <= 2) +#ifdef DEFAULT_JUMBO + if (sc->params.nports <= 2) ifp->if_mtu = ETHERMTU_JUMBO; +#endif if ((err = cxgb_makedev(p)) != 0) { printf("makedev failed %d\n", err); return (err); @@ -1279,7 +1241,7 @@ t3_os_link_changed(adapter_t *adapter, int port_id, int link_status, int speed, void t3_os_phymod_changed(struct adapter *adap, int port_id) { static const char *mod_str[] = { - NULL, "SR", "LR", "LRM", "TWINAX", "TWINAX", "unknown" + NULL, "SR", "LR", "LRM", "TWINAX", "TWINAX-L", "unknown" }; struct port_info *pi = &adap->port[port_id]; int mod = pi->phy.modtype; @@ -1587,11 +1549,7 @@ bind_qsets(adapter_t *sc) static void update_tpeeprom(struct adapter *adap) { -#ifdef FIRMWARE_LATEST const struct firmware *tpeeprom; -#else - struct firmware *tpeeprom; -#endif uint32_t version; unsigned int major, minor; @@ -1649,11 +1607,7 @@ release_tpeeprom: static int update_tpsram(struct adapter *adap) { -#ifdef FIRMWARE_LATEST const struct firmware *tpsram; -#else - struct firmware *tpsram; -#endif int ret; char rev, name[32]; @@ -2003,7 +1957,6 @@ cxgb_uninit_synchronized(struct port_info *pi) return (0); } -#ifdef LRO_SUPPORTED /* * Mark lro enabled or disabled in all qsets for this port */ @@ -2021,7 +1974,6 @@ cxgb_set_lro(struct port_info *p, int enabled) } return (0); } -#endif static int cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) @@ -2106,37 +2058,41 @@ fail: mask = ifr->ifr_reqcap ^ ifp->if_capenable; if (mask & IFCAP_TXCSUM) { - if (IFCAP_TXCSUM & ifp->if_capenable) { - ifp->if_capenable &= ~(IFCAP_TXCSUM|IFCAP_TSO4); - ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP - | CSUM_IP | CSUM_TSO); - } else { - ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP - | CSUM_IP); + ifp->if_capenable ^= IFCAP_TXCSUM; + ifp->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP); + + if (IFCAP_TSO & ifp->if_capenable && + !(IFCAP_TXCSUM & ifp->if_capenable)) { + ifp->if_capenable &= ~IFCAP_TSO; + ifp->if_hwassist &= ~CSUM_TSO; + if_printf(ifp, + "tso disabled due to -txcsum.\n"); } } - if (mask & IFCAP_RXCSUM) { + if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; - } if (mask & IFCAP_TSO4) { - if (IFCAP_TSO4 & ifp->if_capenable) { - ifp->if_capenable &= ~IFCAP_TSO4; - ifp->if_hwassist &= ~CSUM_TSO; - } else if (IFCAP_TXCSUM & ifp->if_capenable) { - ifp->if_capenable |= IFCAP_TSO4; - ifp->if_hwassist |= CSUM_TSO; + ifp->if_capenable ^= IFCAP_TSO4; + + if (IFCAP_TSO & ifp->if_capenable) { + if (IFCAP_TXCSUM & ifp->if_capenable) + ifp->if_hwassist |= CSUM_TSO; + else { + ifp->if_capenable &= ~IFCAP_TSO; + ifp->if_hwassist &= ~CSUM_TSO; + if_printf(ifp, + "enable txcsum first.\n"); + error = EAGAIN; + } } else - error = EINVAL; + ifp->if_hwassist &= ~CSUM_TSO; } -#ifdef LRO_SUPPORTED if (mask & IFCAP_LRO) { ifp->if_capenable ^= IFCAP_LRO; /* Safe to do this even if cxgb_up not called yet */ cxgb_set_lro(p, ifp->if_capenable & IFCAP_LRO); } -#endif if (mask & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { @@ -2153,6 +2109,8 @@ fail: PORT_UNLOCK(p); } } + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (mask & IFCAP_VLAN_HWCSUM) ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; @@ -2444,31 +2402,40 @@ cxgb_tick_handler(void *arg, int count) if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) check_t3b2_mac(sc); - cause = t3_read_reg(sc, A_SG_INT_CAUSE); - reset = 0; - if (cause & F_FLEMPTY) { + cause = t3_read_reg(sc, A_SG_INT_CAUSE) & (F_RSPQSTARVE | F_FLEMPTY); + if (cause) { struct sge_qset *qs = &sc->sge.qs[0]; + uint32_t mask, v; - i = 0; - reset |= F_FLEMPTY; - - cause = (t3_read_reg(sc, A_SG_RSPQ_FL_STATUS) >> - S_FL0EMPTY) & 0xffff; - while (cause) { - qs->fl[i].empty += (cause & 1); - if (i) - qs++; - i ^= 1; - cause >>= 1; + v = t3_read_reg(sc, A_SG_RSPQ_FL_STATUS) & ~0xff00; + + mask = 1; + for (i = 0; i < SGE_QSETS; i++) { + if (v & mask) + qs[i].rspq.starved++; + mask <<= 1; } + + mask <<= SGE_QSETS; /* skip RSPQXDISABLED */ + + for (i = 0; i < SGE_QSETS * 2; i++) { + if (v & mask) { + qs[i / 2].fl[i % 2].empty++; + } + mask <<= 1; + } + + /* clear */ + t3_write_reg(sc, A_SG_RSPQ_FL_STATUS, v); + t3_write_reg(sc, A_SG_INT_CAUSE, cause); } - t3_write_reg(sc, A_SG_INT_CAUSE, reset); for (i = 0; i < sc->params.nports; i++) { struct port_info *pi = &sc->port[i]; struct ifnet *ifp = pi->ifp; struct cmac *mac = &pi->mac; struct mac_stats *mstats = &mac->stats; + int drops, j; if (!isset(&sc->open_device_map, pi->port_id)) continue; @@ -2477,34 +2444,20 @@ cxgb_tick_handler(void *arg, int count) t3_mac_update_stats(mac); PORT_UNLOCK(pi); - ifp->if_opackets = - mstats->tx_frames_64 + - mstats->tx_frames_65_127 + - mstats->tx_frames_128_255 + - mstats->tx_frames_256_511 + - mstats->tx_frames_512_1023 + - mstats->tx_frames_1024_1518 + - mstats->tx_frames_1519_max; - - ifp->if_ipackets = - mstats->rx_frames_64 + - mstats->rx_frames_65_127 + - mstats->rx_frames_128_255 + - mstats->rx_frames_256_511 + - mstats->rx_frames_512_1023 + - mstats->rx_frames_1024_1518 + - mstats->rx_frames_1519_max; - + ifp->if_opackets = mstats->tx_frames; + ifp->if_ipackets = mstats->rx_frames; ifp->if_obytes = mstats->tx_octets; ifp->if_ibytes = mstats->rx_octets; ifp->if_omcasts = mstats->tx_mcast_frames; ifp->if_imcasts = mstats->rx_mcast_frames; - - ifp->if_collisions = - mstats->tx_total_collisions; - + ifp->if_collisions = mstats->tx_total_collisions; ifp->if_iqdrops = mstats->rx_cong_drops; - + + drops = 0; + for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; j++) + drops += sc->sge.qs[j].txq[TXQ_ETH].txq_mr->br_drops; + ifp->if_snd.ifq_drops = drops; + ifp->if_oerrors = mstats->tx_excess_collisions + mstats->tx_underrun + @@ -2761,7 +2714,9 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, t->cong_thres = q->cong_thres; t->qnum = i; - if (sc->flags & USING_MSIX) + if ((sc->flags & FULL_INIT_DONE) == 0) + t->vector = 0; + else if (sc->flags & USING_MSIX) t->vector = rman_get_start(sc->msix_irq_res[i]); else t->vector = rman_get_start(sc->irq_res); diff --git a/sys/dev/cxgb/cxgb_offload.h b/sys/dev/cxgb/cxgb_offload.h index dccefdc..a8b858e 100644 --- a/sys/dev/cxgb/cxgb_offload.h +++ b/sys/dev/cxgb/cxgb_offload.h @@ -33,8 +33,6 @@ $FreeBSD$ #ifndef _CXGB_OFFLOAD_H #define _CXGB_OFFLOAD_H -#include <common/cxgb_version.h> -#include <cxgb_config.h> #include <common/cxgb_tcb.h> #include <t3cdev.h> diff --git a/sys/dev/cxgb/cxgb_osdep.h b/sys/dev/cxgb/cxgb_osdep.h index 9567890..5dc256d 100644 --- a/sys/dev/cxgb/cxgb_osdep.h +++ b/sys/dev/cxgb/cxgb_osdep.h @@ -41,9 +41,6 @@ $FreeBSD$ #include <dev/mii/mii.h> -#define CONFIG_CHELSIO_T3_CORE -#include <common/cxgb_version.h> - #ifndef _CXGB_OSDEP_H_ #define _CXGB_OSDEP_H_ @@ -91,33 +88,6 @@ struct t3_mbuf_hdr { #define MT_DONTFREE 128 -#if __FreeBSD_version > 700030 -#define INTR_FILTERS -#define FIRMWARE_LATEST -#endif - -#if ((__FreeBSD_version > 602103) && (__FreeBSD_version < 700000)) -#define FIRMWARE_LATEST -#endif - -#if __FreeBSD_version > 700000 -#define MSI_SUPPORTED -#define TSO_SUPPORTED -#define VLAN_SUPPORTED -#define TASKQUEUE_CURRENT -#else -#define if_name(ifp) (ifp)->if_xname -#define M_SANITY(m, n) -#endif - -#if __FreeBSD_version >= 701000 -#include "opt_inet.h" -#ifdef INET -#define LRO_SUPPORTED -#define TOE_SUPPORTED -#endif -#endif - #if __FreeBSD_version < 800054 #if defined (__GNUC__) #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 27a7c89..9bc36c9 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_inet.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -50,8 +52,12 @@ __FBSDID("$FreeBSD$"); #include <sys/smp.h> #include <sys/systm.h> #include <sys/syslog.h> +#include <sys/socket.h> #include <net/bpf.h> +#include <net/ethernet.h> +#include <net/if.h> +#include <net/if_vlan_var.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -113,13 +119,9 @@ SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_reclaim_threshold, CTLFLAG_RW, * we have an m_ext */ static int recycle_enable = 0; -int cxgb_ext_freed = 0; -int cxgb_ext_inited = 0; -int fl_q_size = 0; -int jumbo_q_size = 0; extern int cxgb_use_16k_clusters; -extern int nmbjumbo4; +extern int nmbjumbop; extern int nmbjumbo9; extern int nmbjumbo16; @@ -526,21 +528,30 @@ t3_sge_err_intr_handler(adapter_t *adapter) void t3_sge_prep(adapter_t *adap, struct sge_params *p) { - int i, nqsets; + int i, nqsets, fl_q_size, jumbo_q_size, use_16k, jumbo_buf_size; - nqsets = min(SGE_QSETS, mp_ncpus*4); + nqsets = min(SGE_QSETS / adap->params.nports, mp_ncpus); + nqsets *= adap->params.nports; fl_q_size = min(nmbclusters/(3*nqsets), FL_Q_SIZE); while (!powerof2(fl_q_size)) fl_q_size--; + + use_16k = cxgb_use_16k_clusters != -1 ? cxgb_use_16k_clusters : + is_offload(adap); + #if __FreeBSD_version >= 700111 - if (cxgb_use_16k_clusters) + if (use_16k) { jumbo_q_size = min(nmbjumbo16/(3*nqsets), JUMBO_Q_SIZE); - else + jumbo_buf_size = MJUM16BYTES; + } else { jumbo_q_size = min(nmbjumbo9/(3*nqsets), JUMBO_Q_SIZE); + jumbo_buf_size = MJUM9BYTES; + } #else - jumbo_q_size = min(nmbjumbo4/(3*nqsets), JUMBO_Q_SIZE); + jumbo_q_size = min(nmbjumbop/(3*nqsets), JUMBO_Q_SIZE); + jumbo_buf_size = MJUMPAGESIZE; #endif while (!powerof2(jumbo_q_size)) jumbo_q_size--; @@ -549,8 +560,7 @@ t3_sge_prep(adapter_t *adap, struct sge_params *p) device_printf(adap->dev, "Insufficient clusters and/or jumbo buffers.\n"); - /* XXX Does ETHER_ALIGN need to be accounted for here? */ - p->max_pkt_size = adap->sge.qs[0].fl[1].buf_size - sizeof(struct cpl_rx_data); + p->max_pkt_size = jumbo_buf_size - sizeof(struct cpl_rx_data); for (i = 0; i < SGE_QSETS; ++i) { struct qset_params *q = p->qset + i; @@ -568,9 +578,10 @@ t3_sge_prep(adapter_t *adap, struct sge_params *p) q->rspq_size = RSPQ_Q_SIZE; q->fl_size = fl_q_size; q->jumbo_size = jumbo_q_size; + q->jumbo_buf_size = jumbo_buf_size; q->txq_size[TXQ_ETH] = TX_ETH_Q_SIZE; - q->txq_size[TXQ_OFLD] = 1024; - q->txq_size[TXQ_CTRL] = 256; + q->txq_size[TXQ_OFLD] = is_offload(adap) ? TX_OFLD_Q_SIZE : 16; + q->txq_size[TXQ_CTRL] = TX_CTRL_Q_SIZE; q->cong_thres = 0; } } @@ -1145,10 +1156,9 @@ calc_tx_descs(const struct mbuf *m, int nsegs) return 1; flits = sgl_len(nsegs) + 2; -#ifdef TSO_SUPPORTED if (m->m_pkthdr.csum_flags & CSUM_TSO) flits++; -#endif + return flits_to_desc(flits); } @@ -1363,20 +1373,15 @@ write_wr_hdr_sgl(unsigned int ndesc, struct tx_desc *txd, struct txq_state *txqs } } -/* sizeof(*eh) + sizeof(*vhdr) + sizeof(*ip) + sizeof(*tcp) */ -#define TCPPKTHDRSIZE (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + 20 + 20) +/* sizeof(*eh) + sizeof(*ip) + sizeof(*tcp) */ +#define TCPPKTHDRSIZE (ETHER_HDR_LEN + 20 + 20) -#ifdef VLAN_SUPPORTED #define GET_VTAG(cntrl, m) \ do { \ if ((m)->m_flags & M_VLANTAG) \ cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN((m)->m_pkthdr.ether_vtag); \ } while (0) -#else -#define GET_VTAG(cntrl, m) -#endif - static int t3_encap(struct sge_qset *qs, struct mbuf **m) { @@ -1405,19 +1410,15 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) prefetch(txd); m0 = *m; - - DPRINTF("t3_encap port_id=%d qsidx=%d ", pi->port_id, pi->first_qset); - DPRINTF("mlen=%d txpkt_intf=%d tx_chan=%d\n", m[0]->m_pkthdr.len, pi->txpkt_intf, pi->tx_chan); - + mtx_assert(&qs->lock, MA_OWNED); cntrl = V_TXPKT_INTF(pi->txpkt_intf); KASSERT(m0->m_flags & M_PKTHDR, ("not packet header\n")); -#ifdef VLAN_SUPPORTED if (m0->m_nextpkt == NULL && m0->m_next != NULL && m0->m_pkthdr.csum_flags & (CSUM_TSO)) tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); -#endif + if (m0->m_nextpkt != NULL) { busdma_map_sg_vec(txq->entry_tag, txsd->map, m0, segs, &nsegs); ndesc = 1; @@ -1477,15 +1478,16 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) V_WR_GEN(txqs.gen)) | htonl(V_WR_TID(txq->token)); set_wr_hdr(wrp, wr_hi, wr_lo); wmb(); + ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); return (0); } else if (tso_info) { - int min_size = TCPPKTHDRSIZE, eth_type, tagged; + int eth_type; struct cpl_tx_pkt_lso *hdr = (struct cpl_tx_pkt_lso *)txd; + struct ether_header *eh; struct ip *ip; struct tcphdr *tcp; - char *pkthdr; txd->flit[2] = 0; GET_VTAG(cntrl, m0); @@ -1493,13 +1495,7 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) hdr->cntrl = htonl(cntrl); hdr->len = htonl(mlen | 0x80000000); - DPRINTF("tso buf len=%d\n", mlen); - - tagged = m0->m_flags & M_VLANTAG; - if (!tagged) - min_size -= ETHER_VLAN_ENCAP_LEN; - - if (__predict_false(mlen < min_size)) { + if (__predict_false(mlen < TCPPKTHDRSIZE)) { printf("mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%#x,flags=%#x", m0, mlen, m0->m_pkthdr.tso_segsz, m0->m_pkthdr.csum_flags, m0->m_flags); @@ -1507,25 +1503,23 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) } /* Make sure that ether, ip, tcp headers are all in m0 */ - if (__predict_false(m0->m_len < min_size)) { - m0 = m_pullup(m0, min_size); + if (__predict_false(m0->m_len < TCPPKTHDRSIZE)) { + m0 = m_pullup(m0, TCPPKTHDRSIZE); if (__predict_false(m0 == NULL)) { /* XXX panic probably an overreaction */ panic("couldn't fit header into mbuf"); } } - pkthdr = m0->m_data; - if (tagged) { + eh = mtod(m0, struct ether_header *); + if (eh->ether_type == htons(ETHERTYPE_VLAN)) { eth_type = CPL_ETH_II_VLAN; - ip = (struct ip *)(pkthdr + ETHER_HDR_LEN + - ETHER_VLAN_ENCAP_LEN); + ip = (struct ip *)((struct ether_vlan_header *)eh + 1); } else { eth_type = CPL_ETH_II; - ip = (struct ip *)(pkthdr + ETHER_HDR_LEN); + ip = (struct ip *)(eh + 1); } - tcp = (struct tcphdr *)((uint8_t *)ip + - sizeof(*ip)); + tcp = (struct tcphdr *)(ip + 1); tso_info |= V_LSO_ETH_TYPE(eth_type) | V_LSO_IPHDR_WORDS(ip->ip_hl) | @@ -1533,12 +1527,10 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) hdr->lso_info = htonl(tso_info); if (__predict_false(mlen <= PIO_LEN)) { - /* pkt not undersized but fits in PIO_LEN + /* + * pkt not undersized but fits in PIO_LEN * Indicates a TSO bug at the higher levels. - * */ - DPRINTF("**5592 Fix** mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%#x,flags=%#x", - m0, mlen, m0->m_pkthdr.tso_segsz, m0->m_pkthdr.csum_flags, m0->m_flags); txsd->m = NULL; m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[3]); flits = (mlen + 7) / 8 + 3; @@ -1549,8 +1541,10 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); set_wr_hdr(&hdr->wr, wr_hi, wr_lo); wmb(); + ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); + m_freem(m0); return (0); } flits = 3; @@ -1578,8 +1572,10 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); set_wr_hdr(&cpl->wr, wr_hi, wr_lo); wmb(); + ETHER_BPF_MTAP(pi->ifp, m0); wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); + m_freem(m0); return (0); } flits = 2; @@ -1590,12 +1586,14 @@ t3_encap(struct sge_qset *qs, struct mbuf **m) sgl_flits = sgl_len(nsegs); + ETHER_BPF_MTAP(pi->ifp, m0); + KASSERT(ndesc <= 4, ("ndesc too large %d", ndesc)); wr_hi = htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wr_lo = htonl(V_WR_TID(txq->token)); write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, sgl_flits, wr_hi, wr_lo); - check_ring_tx_db(pi->adapter, txq); + check_ring_tx_db(sc, txq); return (0); } @@ -1645,12 +1643,9 @@ cxgb_start_locked(struct sge_qset *qs) { struct mbuf *m_head = NULL; struct sge_txq *txq = &qs->txq[TXQ_ETH]; - int avail, txmax; int in_use_init = txq->in_use; struct port_info *pi = qs->port; struct ifnet *ifp = pi->ifp; - avail = txq->size - txq->in_use - 4; - txmax = min(TX_START_MAX_DESC, avail); if (qs->qs_flags & (QS_FLUSHING|QS_TIMEOUT)) reclaim_completed_tx(qs, 0, TXQ_ETH); @@ -1660,12 +1655,14 @@ cxgb_start_locked(struct sge_qset *qs) return; } TXQ_LOCK_ASSERT(qs); - while ((txq->in_use - in_use_init < txmax) && - !TXQ_RING_EMPTY(qs) && - (ifp->if_drv_flags & IFF_DRV_RUNNING) && + while ((txq->in_use - in_use_init < TX_START_MAX_DESC) && + !TXQ_RING_EMPTY(qs) && (ifp->if_drv_flags & IFF_DRV_RUNNING) && pi->link_config.link_ok) { reclaim_completed_tx(qs, cxgb_tx_reclaim_threshold, TXQ_ETH); + if (txq->size - txq->in_use <= TX_MAX_DESC) + break; + if ((m_head = cxgb_dequeue(qs)) == NULL) break; /* @@ -1674,16 +1671,6 @@ cxgb_start_locked(struct sge_qset *qs) */ if (t3_encap(qs, &m_head) || m_head == NULL) break; - - /* Send a copy of the frame to the BPF listener */ - ETHER_BPF_MTAP(ifp, m_head); - - /* - * We sent via PIO, no longer need a copy - */ - if (m_head->m_nextpkt == NULL && - m_head->m_pkthdr.len <= PIO_LEN) - m_freem(m_head); m_head = NULL; } @@ -1714,7 +1701,7 @@ cxgb_transmit_locked(struct ifnet *ifp, struct sge_qset *qs, struct mbuf *m) * - there is space in hardware transmit queue */ if (check_pkt_coalesce(qs) == 0 && - !TXQ_RING_NEEDS_ENQUEUE(qs) && avail > 4) { + !TXQ_RING_NEEDS_ENQUEUE(qs) && avail > TX_MAX_DESC) { if (t3_encap(qs, &m)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) @@ -1726,17 +1713,6 @@ cxgb_transmit_locked(struct ifnet *ifp, struct sge_qset *qs, struct mbuf *m) */ txq->txq_direct_packets++; txq->txq_direct_bytes += m->m_pkthdr.len; - /* - ** Send a copy of the frame to the BPF - ** listener and set the watchdog on. - */ - ETHER_BPF_MTAP(ifp, m); - /* - * We sent via PIO, no longer need a copy - */ - if (m->m_pkthdr.len <= PIO_LEN) - m_freem(m); - } } else if ((error = drbr_enqueue(ifp, br, m)) != 0) return (error); @@ -2033,15 +2009,13 @@ t3_free_qset(adapter_t *sc, struct sge_qset *q) int i; reclaim_completed_tx(q, 0, TXQ_ETH); - for (i = 0; i < SGE_TXQ_PER_SET; i++) { - if (q->txq[i].txq_mr != NULL) - buf_ring_free(q->txq[i].txq_mr, M_DEVBUF); - if (q->txq[i].txq_ifq != NULL) { - ifq_delete(q->txq[i].txq_ifq); - free(q->txq[i].txq_ifq, M_DEVBUF); - } + if (q->txq[TXQ_ETH].txq_mr != NULL) + buf_ring_free(q->txq[TXQ_ETH].txq_mr, M_DEVBUF); + if (q->txq[TXQ_ETH].txq_ifq != NULL) { + ifq_delete(q->txq[TXQ_ETH].txq_ifq); + free(q->txq[TXQ_ETH].txq_ifq, M_DEVBUF); } - + for (i = 0; i < SGE_RXQ_PER_SET; ++i) { if (q->fl[i].desc) { mtx_lock_spin(&sc->sge.reg_lock); @@ -2090,7 +2064,7 @@ t3_free_qset(adapter_t *sc, struct sge_qset *q) MTX_DESTROY(&q->rspq.lock); } -#ifdef LRO_SUPPORTED +#ifdef INET tcp_lro_free(&q->lro.ctrl); #endif @@ -2578,25 +2552,22 @@ t3_sge_alloc_qset(adapter_t *sc, u_int id, int nports, int irq_vec_idx, MTX_INIT(&q->lock, q->namebuf, NULL, MTX_DEF); q->port = pi; - for (i = 0; i < SGE_TXQ_PER_SET; i++) { - - if ((q->txq[i].txq_mr = buf_ring_alloc(cxgb_txq_buf_ring_size, - M_DEVBUF, M_WAITOK, &q->lock)) == NULL) { - device_printf(sc->dev, "failed to allocate mbuf ring\n"); - goto err; - } - if ((q->txq[i].txq_ifq = - malloc(sizeof(struct ifaltq), M_DEVBUF, M_NOWAIT|M_ZERO)) - == NULL) { - device_printf(sc->dev, "failed to allocate ifq\n"); - goto err; - } - ifq_init(q->txq[i].txq_ifq, pi->ifp); - callout_init(&q->txq[i].txq_timer, 1); - callout_init(&q->txq[i].txq_watchdog, 1); - q->txq[i].txq_timer.c_cpu = id % mp_ncpus; - q->txq[i].txq_watchdog.c_cpu = id % mp_ncpus; + if ((q->txq[TXQ_ETH].txq_mr = buf_ring_alloc(cxgb_txq_buf_ring_size, + M_DEVBUF, M_WAITOK, &q->lock)) == NULL) { + device_printf(sc->dev, "failed to allocate mbuf ring\n"); + goto err; + } + if ((q->txq[TXQ_ETH].txq_ifq = malloc(sizeof(struct ifaltq), M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) { + device_printf(sc->dev, "failed to allocate ifq\n"); + goto err; } + ifq_init(q->txq[TXQ_ETH].txq_ifq, pi->ifp); + callout_init(&q->txq[TXQ_ETH].txq_timer, 1); + callout_init(&q->txq[TXQ_ETH].txq_watchdog, 1); + q->txq[TXQ_ETH].txq_timer.c_cpu = id % mp_ncpus; + q->txq[TXQ_ETH].txq_watchdog.c_cpu = id % mp_ncpus; + init_qset_cntxt(q, id); q->idx = id; if ((ret = alloc_ring(sc, p->fl_size, sizeof(struct rx_desc), @@ -2661,32 +2632,33 @@ t3_sge_alloc_qset(adapter_t *sc, u_int id, int nports, int irq_vec_idx, q->fl[0].buf_size = MCLBYTES; q->fl[0].zone = zone_pack; q->fl[0].type = EXT_PACKET; -#if __FreeBSD_version > 800000 - if (cxgb_use_16k_clusters) { - q->fl[1].buf_size = MJUM16BYTES; + + if (p->jumbo_buf_size == MJUM16BYTES) { q->fl[1].zone = zone_jumbo16; q->fl[1].type = EXT_JUMBO16; - } else { - q->fl[1].buf_size = MJUM9BYTES; + } else if (p->jumbo_buf_size == MJUM9BYTES) { q->fl[1].zone = zone_jumbo9; q->fl[1].type = EXT_JUMBO9; + } else if (p->jumbo_buf_size == MJUMPAGESIZE) { + q->fl[1].zone = zone_jumbop; + q->fl[1].type = EXT_JUMBOP; + } else { + KASSERT(0, ("can't deal with jumbo_buf_size %d.", p->jumbo_buf_size)); + ret = EDOOFUS; + goto err; } -#else - q->fl[1].buf_size = MJUMPAGESIZE; - q->fl[1].zone = zone_jumbop; - q->fl[1].type = EXT_JUMBOP; -#endif + q->fl[1].buf_size = p->jumbo_buf_size; -#ifdef LRO_SUPPORTED /* Allocate and setup the lro_ctrl structure */ q->lro.enabled = !!(pi->ifp->if_capenable & IFCAP_LRO); +#ifdef INET ret = tcp_lro_init(&q->lro.ctrl); if (ret) { printf("error %d from tcp_lro_init\n", ret); goto err; } - q->lro.ctrl.ifp = pi->ifp; #endif + q->lro.ctrl.ifp = pi->ifp; mtx_lock_spin(&sc->sge.reg_lock); ret = -t3_sge_init_rspcntxt(sc, q->rspq.cntxt_id, irq_vec_idx, @@ -2787,16 +2759,12 @@ t3_rx_eth(struct adapter *adap, struct sge_rspq *rq, struct mbuf *m, int ethpad) m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED|CSUM_IP_VALID|CSUM_DATA_VALID|CSUM_PSEUDO_HDR); m->m_pkthdr.csum_data = 0xffff; } - /* - * XXX need to add VLAN support for 6.x - */ -#ifdef VLAN_SUPPORTED - if (__predict_false(cpl->vlan_valid)) { + + if (cpl->vlan_valid) { m->m_pkthdr.ether_vtag = ntohs(cpl->vlan); m->m_flags |= M_VLANTAG; } -#endif - + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; /* @@ -2976,11 +2944,9 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget) struct rsp_desc *r = &rspq->desc[rspq->cidx]; int budget_left = budget; unsigned int sleeping = 0; -#ifdef LRO_SUPPORTED int lro_enabled = qs->lro.enabled; int skip_lro; struct lro_ctrl *lro_ctrl = &qs->lro.ctrl; -#endif struct mbuf *offload_mbufs[RX_BUNDLE_SIZE]; int ngathered = 0; #ifdef DEBUG @@ -3089,7 +3055,6 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget) t3_rx_eth(adap, rspq, m, ethpad); -#ifdef LRO_SUPPORTED /* * The T304 sends incoming packets on any qset. If LRO * is also enabled, we could end up sending packet up @@ -3100,12 +3065,13 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget) */ skip_lro = __predict_false(qs->port->ifp != m->m_pkthdr.rcvif); - if (lro_enabled && lro_ctrl->lro_cnt && !skip_lro && - (tcp_lro_rx(lro_ctrl, m, 0) == 0)) { - /* successfully queue'd for LRO */ - } else + if (lro_enabled && lro_ctrl->lro_cnt && !skip_lro +#ifdef INET + && (tcp_lro_rx(lro_ctrl, m, 0) == 0) #endif - { + ) { + /* successfully queue'd for LRO */ + } else { /* * LRO not enabled, packet unsuitable for LRO, * or unable to queue. Pass it up right now in @@ -3124,7 +3090,7 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget) deliver_partial_bundle(&adap->tdev, rspq, offload_mbufs, ngathered); -#ifdef LRO_SUPPORTED +#ifdef INET /* Flush LRO */ while (!SLIST_EMPTY(&lro_ctrl->lro_active)) { struct lro_entry *queued = SLIST_FIRST(&lro_ctrl->lro_active); @@ -3620,6 +3586,9 @@ t3_add_configured_sysctls(adapter_t *sc) SYSCTL_ADD_UINT(ctx, rspqpoidlist, OID_AUTO, "credits", CTLFLAG_RD, &qs->rspq.credits, 0, "#credits"); + SYSCTL_ADD_UINT(ctx, rspqpoidlist, OID_AUTO, "starved", + CTLFLAG_RD, &qs->rspq.starved, + 0, "#times starved"); SYSCTL_ADD_XLONG(ctx, rspqpoidlist, OID_AUTO, "phys_addr", CTLFLAG_RD, &qs->rspq.phys_addr, "physical_address_of the queue"); @@ -3633,10 +3602,9 @@ t3_add_configured_sysctls(adapter_t *sc) CTLTYPE_STRING | CTLFLAG_RD, &qs->rspq, 0, t3_dump_rspq, "A", "dump of the response queue"); - - SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "dropped", - CTLFLAG_RD, &qs->txq[TXQ_ETH].txq_drops, - 0, "#tunneled packets dropped"); + SYSCTL_ADD_QUAD(ctx, txqpoidlist, OID_AUTO, "dropped", + CTLFLAG_RD, &qs->txq[TXQ_ETH].txq_mr->br_drops, + "#tunneled packets dropped"); SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "sendqlen", CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.qlen, 0, "#tunneled packets waiting to be sent"); @@ -3704,7 +3672,6 @@ t3_add_configured_sysctls(adapter_t *sc) CTLTYPE_STRING | CTLFLAG_RD, &qs->txq[TXQ_CTRL], 0, t3_dump_txq_ctrl, "A", "dump of the transmit queue"); -#ifdef LRO_SUPPORTED SYSCTL_ADD_INT(ctx, lropoidlist, OID_AUTO, "lro_queued", CTLFLAG_RD, &qs->lro.ctrl.lro_queued, 0, NULL); SYSCTL_ADD_INT(ctx, lropoidlist, OID_AUTO, "lro_flushed", @@ -3713,7 +3680,6 @@ t3_add_configured_sysctls(adapter_t *sc) CTLFLAG_RD, &qs->lro.ctrl.lro_bad_csum, 0, NULL); SYSCTL_ADD_INT(ctx, lropoidlist, OID_AUTO, "lro_cnt", CTLFLAG_RD, &qs->lro.ctrl.lro_cnt, 0, NULL); -#endif } /* Now add a node for mac stats. */ diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c index cf42ea0..a4f2ff6 100644 --- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c +++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c @@ -138,8 +138,7 @@ open_rnic_dev(struct t3cdev *tdev) CTR2(KTR_IW_CXGB, "%s t3cdev %p", __FUNCTION__, tdev); if (!vers_printed++) - printf("Chelsio T3 RDMA Driver - version %s\n", - DRV_VERSION); + printf("Chelsio T3 RDMA Driver - version x.xx\n"); rnicp = (struct iwch_dev *)ib_alloc_device(sizeof(*rnicp)); if (!rnicp) { printf("Cannot allocate ib device\n"); diff --git a/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c b/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c index 76237fb..bbb594a 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c +++ b/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/in_systm.h> #include <netinet/in_var.h> -#include <cxgb_config.h> #include <cxgb_osdep.h> #include <sys/mbufq.h> #include <ulp/tom/cxgb_tcp_offload.h> diff --git a/sys/modules/cxgb/cxgb/Makefile b/sys/modules/cxgb/cxgb/Makefile index 65b2f6f..9a433b2 100644 --- a/sys/modules/cxgb/cxgb/Makefile +++ b/sys/modules/cxgb/cxgb/Makefile @@ -12,13 +12,5 @@ SRCS+= opt_inet.h opt_zero.h opt_sched.h SRCS+= uipc_mvec.c CFLAGS+= -g -DDEFAULT_JUMBO -I${CXGB} -CFLAGS+= -DDISABLE_MBUF_IOVEC -#CFLAGS+= -DIFNET_MULTIQUEUE -#CFLAGS+= -DDISABLE_MBUF_IOVEC -#CFLAGS+= -DDEBUG -DDEBUG_PRINT -#CFLAGS+= -DINVARIANT_SUPPORT -DINVARIANTS -#CFLAGS+= -DWITNESS -#CFLAGS += -DLOCK_PROFILING -#CFLAGS+= -DWITNESS .include <bsd.kmod.mk> |