bnxt: HW_LRO Rx Pkt with > 32 fragments caused Crash (iflib)
ClosedPublic

Authored by bhargava.marreddy_broadcom.com on Oct 24 2017, 1:28 PM.

Details

Summary

Broadcom NIC with HW_LRO setting max_agg_segs = 6 can generate Rx pkt with 64 (2^6) fragments,
Modify IFLIB_MAX_RX_SEGS to 64 to avoid memory corruption / Crash.

Test Plan

Verified iperf TCP, no issue seen.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
shurd added a comment.Oct 24 2017, 7:28 PM

How many are required when max_agg_segs == 7? With that value change in future hardware designs?

How many are required when max_agg_segs == 7? With that value change in future hardware designs?

Though I'm seeing max of 45 in my setup, Theoretical max num_frags is 66 (64 frags + 1 TPA_Start + 1 TPA_End).

Modify IFLIB_MAX_RX_SEGS to 66 which is theoretical maximum for BRCM NIC (64 + 1 TPA_START + 1 TPA_END)

shurd accepted this revision.Oct 26 2017, 3:33 PM

It doesn't look like the driver currently supports more than (RX_TPA_END_CMPL_AGG_BUFS_MASK >> RX_TPA_END_CMPL_AGG_BUFS_SFT) + 1 (64), so 64 seems like the best number if we change it here.

The other options are to put the max frags value in struct if_softc_ctx and have it dynamically allocated, or to have the driver limit the value to 32. I think this one is fine if changed back to 64 (or the driver is updated to support > 64).

This revision is now accepted and ready to land.Oct 26 2017, 3:33 PM
shurd added inline comments.Oct 26 2017, 3:34 PM
sys/net/iflib.c
289 ↗(On Diff #34316)

Change back to 64.

Add comment: /* bnxt supports 64 with hardware LRO enabled */ before the define.

Taken care of review comments.

This revision now requires review to proceed.Oct 27 2017, 6:16 AM
bhargava.marreddy_broadcom.com marked an inline comment as done.Oct 27 2017, 6:17 AM
bhargava.marreddy_broadcom.com added inline comments.
sys/net/iflib.c
289 ↗(On Diff #34316)

Taken care.

sbruno accepted this revision.Oct 30 2017, 8:18 PM
This revision is now accepted and ready to land.Oct 30 2017, 8:18 PM
This revision was automatically updated to reflect the committed changes.