* * Initialize all receive rings. * **********************************************************************/
| 5835 | * |
| 5836 | **********************************************************************/ |
| 5837 | static int |
| 5838 | iflib_rx_structures_setup(if_ctx_t ctx) |
| 5839 | { |
| 5840 | iflib_rxq_t rxq = ctx->ifc_rxqs; |
| 5841 | int q; |
| 5842 | #if defined(INET6) || defined(INET) |
| 5843 | int err, i; |
| 5844 | #endif |
| 5845 | |
| 5846 | for (q = 0; q < ctx->ifc_softc_ctx.isc_nrxqsets; q++, rxq++) { |
| 5847 | #if defined(INET6) || defined(INET) |
| 5848 | if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) { |
| 5849 | err = tcp_lro_init_args(&rxq->ifr_lc, ctx->ifc_ifp, |
| 5850 | TCP_LRO_ENTRIES, min(1024, |
| 5851 | ctx->ifc_softc_ctx.isc_nrxd[rxq->ifr_fl_offset])); |
| 5852 | if (err != 0) { |
| 5853 | device_printf(ctx->ifc_dev, |
| 5854 | "LRO Initialization failed!\n"); |
| 5855 | goto fail; |
| 5856 | } |
| 5857 | } |
| 5858 | #endif |
| 5859 | IFDI_RXQ_SETUP(ctx, rxq->ifr_id); |
| 5860 | } |
| 5861 | return (0); |
| 5862 | #if defined(INET6) || defined(INET) |
| 5863 | fail: |
| 5864 | /* |
| 5865 | * Free LRO resources allocated so far, we will only handle |
| 5866 | * the rings that completed, the failing case will have |
| 5867 | * cleaned up for itself. 'q' failed, so its the terminus. |
| 5868 | */ |
| 5869 | rxq = ctx->ifc_rxqs; |
| 5870 | for (i = 0; i < q; ++i, rxq++) { |
| 5871 | if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) |
| 5872 | tcp_lro_free(&rxq->ifr_lc); |
| 5873 | } |
| 5874 | return (err); |
| 5875 | #endif |
| 5876 | } |
| 5877 | |
| 5878 | /********************************************************************* |
| 5879 | * |
no test coverage detected