iflib.c (3f43ada98c89bce5ae416e203ba0e81595a5cd88) | iflib.c (38bfc6dee33bedb290e1ea2540f97a86fe3caee0) |
---|---|
1/*- 2 * Copyright (c) 2014-2018, Matthew Macy <mmacy@mattmacy.io> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 4886 unchanged lines hidden (view full) --- 4895 if ((err = iflib_legacy_setup(ctx, ctx->isc_legacy_intr, ctx->ifc_softc, &rid, "irq0")) != 0) { 4896 device_printf(dev, "iflib_legacy_setup failed %d\n", err); 4897 goto fail_queues; 4898 } 4899 } else { 4900 device_printf(dev, 4901 "Cannot use iflib with only 1 MSI-X interrupt!\n"); 4902 err = ENODEV; | 1/*- 2 * Copyright (c) 2014-2018, Matthew Macy <mmacy@mattmacy.io> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 4886 unchanged lines hidden (view full) --- 4895 if ((err = iflib_legacy_setup(ctx, ctx->isc_legacy_intr, ctx->ifc_softc, &rid, "irq0")) != 0) { 4896 device_printf(dev, "iflib_legacy_setup failed %d\n", err); 4897 goto fail_queues; 4898 } 4899 } else { 4900 device_printf(dev, 4901 "Cannot use iflib with only 1 MSI-X interrupt!\n"); 4902 err = ENODEV; |
4903 goto fail_intr_free; | 4903 goto fail_queues; |
4904 } 4905 4906 ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet); 4907 4908 if ((err = IFDI_ATTACH_POST(ctx)) != 0) { 4909 device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); 4910 goto fail_detach; 4911 } --- 19 unchanged lines hidden (view full) --- 4931 iflib_add_pfil(ctx); 4932 ctx->ifc_flags |= IFC_INIT_DONE; 4933 CTX_UNLOCK(ctx); 4934 4935 return (0); 4936 4937fail_detach: 4938 ether_ifdetach(ctx->ifc_ifp); | 4904 } 4905 4906 ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet); 4907 4908 if ((err = IFDI_ATTACH_POST(ctx)) != 0) { 4909 device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err); 4910 goto fail_detach; 4911 } --- 19 unchanged lines hidden (view full) --- 4931 iflib_add_pfil(ctx); 4932 ctx->ifc_flags |= IFC_INIT_DONE; 4933 CTX_UNLOCK(ctx); 4934 4935 return (0); 4936 4937fail_detach: 4938 ether_ifdetach(ctx->ifc_ifp); |
4939fail_intr_free: 4940 iflib_free_intr_mem(ctx); | |
4941fail_queues: | 4939fail_queues: |
4940 iflib_tqg_detach(ctx); |
|
4942 iflib_tx_structures_free(ctx); 4943 iflib_rx_structures_free(ctx); | 4941 iflib_tx_structures_free(ctx); 4942 iflib_rx_structures_free(ctx); |
4944 iflib_tqg_detach(ctx); | |
4945 IFDI_DETACH(ctx); | 4943 IFDI_DETACH(ctx); |
4944 IFDI_QUEUES_FREE(ctx); 4945fail_intr_free: 4946 iflib_free_intr_mem(ctx); |
|
4946fail_unlock: 4947 CTX_UNLOCK(ctx); 4948 iflib_deregister(ctx); 4949fail_ctx_free: 4950 device_set_softc(ctx->ifc_dev, NULL); 4951 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 4952 free(ctx->ifc_softc, M_IFLIB); 4953 free(ctx, M_IFLIB); --- 180 unchanged lines hidden (view full) --- 5134 iflib_add_device_sysctl_post(ctx); 5135 ctx->ifc_flags |= IFC_INIT_DONE; 5136 CTX_UNLOCK(ctx); 5137 5138 return (0); 5139fail_detach: 5140 ether_ifdetach(ctx->ifc_ifp); 5141fail_queues: | 4947fail_unlock: 4948 CTX_UNLOCK(ctx); 4949 iflib_deregister(ctx); 4950fail_ctx_free: 4951 device_set_softc(ctx->ifc_dev, NULL); 4952 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 4953 free(ctx->ifc_softc, M_IFLIB); 4954 free(ctx, M_IFLIB); --- 180 unchanged lines hidden (view full) --- 5135 iflib_add_device_sysctl_post(ctx); 5136 ctx->ifc_flags |= IFC_INIT_DONE; 5137 CTX_UNLOCK(ctx); 5138 5139 return (0); 5140fail_detach: 5141 ether_ifdetach(ctx->ifc_ifp); 5142fail_queues: |
5143 iflib_tqg_detach(ctx); |
|
5142 iflib_tx_structures_free(ctx); 5143 iflib_rx_structures_free(ctx); | 5144 iflib_tx_structures_free(ctx); 5145 iflib_rx_structures_free(ctx); |
5144 iflib_tqg_detach(ctx); | |
5145fail_iflib_detach: 5146 IFDI_DETACH(ctx); | 5146fail_iflib_detach: 5147 IFDI_DETACH(ctx); |
5148 IFDI_QUEUES_FREE(ctx); |
|
5147fail_unlock: 5148 CTX_UNLOCK(ctx); 5149 iflib_deregister(ctx); 5150fail_ctx_free: 5151 free(ctx->ifc_softc, M_IFLIB); 5152 free(ctx, M_IFLIB); 5153 return (err); 5154} --- 13 unchanged lines hidden (view full) --- 5168 if_detach(ifp); 5169 } else { 5170 ether_ifdetach(ifp); 5171 } 5172 5173 iflib_tqg_detach(ctx); 5174 iflib_tx_structures_free(ctx); 5175 iflib_rx_structures_free(ctx); | 5149fail_unlock: 5150 CTX_UNLOCK(ctx); 5151 iflib_deregister(ctx); 5152fail_ctx_free: 5153 free(ctx->ifc_softc, M_IFLIB); 5154 free(ctx, M_IFLIB); 5155 return (err); 5156} --- 13 unchanged lines hidden (view full) --- 5170 if_detach(ifp); 5171 } else { 5172 ether_ifdetach(ifp); 5173 } 5174 5175 iflib_tqg_detach(ctx); 5176 iflib_tx_structures_free(ctx); 5177 iflib_rx_structures_free(ctx); |
5178 IFDI_DETACH(ctx); 5179 IFDI_QUEUES_FREE(ctx); |
|
5176 5177 iflib_deregister(ctx); 5178 5179 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 5180 free(ctx->ifc_softc, M_IFLIB); 5181 free(ctx, M_IFLIB); 5182 return (0); 5183} --- 44 unchanged lines hidden (view full) --- 5228 iflib_stop(ctx); 5229 CTX_UNLOCK(ctx); 5230 5231 iflib_rem_pfil(ctx); 5232 if (ctx->ifc_led_dev != NULL) 5233 led_destroy(ctx->ifc_led_dev); 5234 5235 iflib_tqg_detach(ctx); | 5180 5181 iflib_deregister(ctx); 5182 5183 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 5184 free(ctx->ifc_softc, M_IFLIB); 5185 free(ctx, M_IFLIB); 5186 return (0); 5187} --- 44 unchanged lines hidden (view full) --- 5232 iflib_stop(ctx); 5233 CTX_UNLOCK(ctx); 5234 5235 iflib_rem_pfil(ctx); 5236 if (ctx->ifc_led_dev != NULL) 5237 led_destroy(ctx->ifc_led_dev); 5238 5239 iflib_tqg_detach(ctx); |
5240 iflib_tx_structures_free(ctx); 5241 iflib_rx_structures_free(ctx); 5242 |
|
5236 CTX_LOCK(ctx); 5237 IFDI_DETACH(ctx); | 5243 CTX_LOCK(ctx); 5244 IFDI_DETACH(ctx); |
5245 IFDI_QUEUES_FREE(ctx); |
|
5238 CTX_UNLOCK(ctx); 5239 5240 /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ 5241 iflib_free_intr_mem(ctx); 5242 5243 bus_generic_detach(dev); 5244 | 5246 CTX_UNLOCK(ctx); 5247 5248 /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ 5249 iflib_free_intr_mem(ctx); 5250 5251 bus_generic_detach(dev); 5252 |
5245 iflib_tx_structures_free(ctx); 5246 iflib_rx_structures_free(ctx); 5247 | |
5248 iflib_deregister(ctx); 5249 5250 device_set_softc(ctx->ifc_dev, NULL); 5251 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 5252 free(ctx->ifc_softc, M_IFLIB); 5253 unref_ctx_core_offset(ctx); 5254 free(ctx, M_IFLIB); 5255 return (0); --- 567 unchanged lines hidden (view full) --- 5823 5824 for (i = 0; i < NTXQSETS(ctx); i++, txq++) { 5825 for (j = 0; j < sctx->isc_ntxqs; j++) 5826 iflib_dma_free(&txq->ift_ifdi[j]); 5827 iflib_txq_destroy(txq); 5828 } 5829 free(ctx->ifc_txqs, M_IFLIB); 5830 ctx->ifc_txqs = NULL; | 5253 iflib_deregister(ctx); 5254 5255 device_set_softc(ctx->ifc_dev, NULL); 5256 if (ctx->ifc_flags & IFC_SC_ALLOCATED) 5257 free(ctx->ifc_softc, M_IFLIB); 5258 unref_ctx_core_offset(ctx); 5259 free(ctx, M_IFLIB); 5260 return (0); --- 567 unchanged lines hidden (view full) --- 5828 5829 for (i = 0; i < NTXQSETS(ctx); i++, txq++) { 5830 for (j = 0; j < sctx->isc_ntxqs; j++) 5831 iflib_dma_free(&txq->ift_ifdi[j]); 5832 iflib_txq_destroy(txq); 5833 } 5834 free(ctx->ifc_txqs, M_IFLIB); 5835 ctx->ifc_txqs = NULL; |
5831 IFDI_QUEUES_FREE(ctx); | |
5832} 5833 5834/********************************************************************* 5835 * 5836 * Initialize all receive rings. 5837 * 5838 **********************************************************************/ 5839static int --- 1150 unchanged lines hidden --- | 5836} 5837 5838/********************************************************************* 5839 * 5840 * Initialize all receive rings. 5841 * 5842 **********************************************************************/ 5843static int --- 1150 unchanged lines hidden --- |