Deleted Added
full compact
ixl_txrx.c (270919) ixl_txrx.c (272313)
1/******************************************************************************
2
3 Copyright (c) 2013-2014, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32******************************************************************************/
1/******************************************************************************
2
3 Copyright (c) 2013-2014, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32******************************************************************************/
33/*$FreeBSD: stable/10/sys/dev/ixl/ixl_txrx.c 270919 2014-09-01 07:54:30Z jfv $*/
33/*$FreeBSD: stable/10/sys/dev/ixl/ixl_txrx.c 272313 2014-09-30 16:55:19Z bz $*/
34
35/*
36** IXL driver TX/RX Routines:
37** This was seperated to allow usage by
38** both the BASE and the VF drivers.
39*/
40
41#include "opt_inet.h"

--- 1038 unchanged lines hidden (view full) ---

1080/*********************************************************************
1081 *
1082 * (Re)Initialize the queue receive ring and its buffers.
1083 *
1084 **********************************************************************/
1085int
1086ixl_init_rx_ring(struct ixl_queue *que)
1087{
34
35/*
36** IXL driver TX/RX Routines:
37** This was seperated to allow usage by
38** both the BASE and the VF drivers.
39*/
40
41#include "opt_inet.h"

--- 1038 unchanged lines hidden (view full) ---

1080/*********************************************************************
1081 *
1082 * (Re)Initialize the queue receive ring and its buffers.
1083 *
1084 **********************************************************************/
1085int
1086ixl_init_rx_ring(struct ixl_queue *que)
1087{
1088 struct rx_ring *rxr = &que->rxr;
1089#if defined(INET6) || defined(INET)
1088 struct ixl_vsi *vsi = que->vsi;
1089 struct ifnet *ifp = vsi->ifp;
1090 struct ixl_vsi *vsi = que->vsi;
1091 struct ifnet *ifp = vsi->ifp;
1090 struct rx_ring *rxr = &que->rxr;
1091 struct lro_ctrl *lro = &rxr->lro;
1092 struct lro_ctrl *lro = &rxr->lro;
1093#endif
1092 struct ixl_rx_buf *buf;
1093 bus_dma_segment_t pseg[1], hseg[1];
1094 int rsize, nsegs, error = 0;
1095
1096 IXL_RX_LOCK(rxr);
1097 /* Clear the ring contents */
1098 rsize = roundup2(que->num_desc *
1099 sizeof(union i40e_rx_desc), DBA_ALIGN);

--- 82 unchanged lines hidden (view full) ---

1182 /* Setup our descriptor indices */
1183 rxr->next_check = 0;
1184 rxr->next_refresh = 0;
1185 rxr->lro_enabled = FALSE;
1186 rxr->split = 0;
1187 rxr->bytes = 0;
1188 rxr->discard = FALSE;
1189
1094 struct ixl_rx_buf *buf;
1095 bus_dma_segment_t pseg[1], hseg[1];
1096 int rsize, nsegs, error = 0;
1097
1098 IXL_RX_LOCK(rxr);
1099 /* Clear the ring contents */
1100 rsize = roundup2(que->num_desc *
1101 sizeof(union i40e_rx_desc), DBA_ALIGN);

--- 82 unchanged lines hidden (view full) ---

1184 /* Setup our descriptor indices */
1185 rxr->next_check = 0;
1186 rxr->next_refresh = 0;
1187 rxr->lro_enabled = FALSE;
1188 rxr->split = 0;
1189 rxr->bytes = 0;
1190 rxr->discard = FALSE;
1191
1192#if defined(INET6) || defined(INET)
1190 /*
1191 ** Now set up the LRO interface:
1192 */
1193 if (ifp->if_capenable & IFCAP_LRO) {
1194 int err = tcp_lro_init(lro);
1195 if (err) {
1196 if_printf(ifp, "queue %d: LRO Initialization failed!\n", que->me);
1197 goto fail;
1198 }
1199 INIT_DBG_IF(ifp, "queue %d: RX Soft LRO Initialized", que->me);
1200 rxr->lro_enabled = TRUE;
1201 lro->ifp = vsi->ifp;
1202 }
1193 /*
1194 ** Now set up the LRO interface:
1195 */
1196 if (ifp->if_capenable & IFCAP_LRO) {
1197 int err = tcp_lro_init(lro);
1198 if (err) {
1199 if_printf(ifp, "queue %d: LRO Initialization failed!\n", que->me);
1200 goto fail;
1201 }
1202 INIT_DBG_IF(ifp, "queue %d: RX Soft LRO Initialized", que->me);
1203 rxr->lro_enabled = TRUE;
1204 lro->ifp = vsi->ifp;
1205 }
1206#endif
1203
1204 bus_dmamap_sync(rxr->dma.tag, rxr->dma.map,
1205 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1206
1207fail:
1208 IXL_RX_UNLOCK(rxr);
1209 return (error);
1210}

--- 58 unchanged lines hidden (view full) ---

1269
1270 INIT_DBG_IF(que->vsi->ifp, "queue %d: end", que->me);
1271 return;
1272}
1273
1274static __inline void
1275ixl_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u8 ptype)
1276{
1207
1208 bus_dmamap_sync(rxr->dma.tag, rxr->dma.map,
1209 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1210
1211fail:
1212 IXL_RX_UNLOCK(rxr);
1213 return (error);
1214}

--- 58 unchanged lines hidden (view full) ---

1273
1274 INIT_DBG_IF(que->vsi->ifp, "queue %d: end", que->me);
1275 return;
1276}
1277
1278static __inline void
1279ixl_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u8 ptype)
1280{
1281
1282#if defined(INET6) || defined(INET)
1277 /*
1278 * ATM LRO is only for IPv4/TCP packets and TCP checksum of the packet
1279 * should be computed by hardware. Also it should not have VLAN tag in
1280 * ethernet header.
1281 */
1282 if (rxr->lro_enabled &&
1283 (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
1284 (m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) ==
1285 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) {
1286 /*
1287 * Send to the stack if:
1288 ** - LRO not enabled, or
1289 ** - no LRO resources, or
1290 ** - lro enqueue fails
1291 */
1292 if (rxr->lro.lro_cnt != 0)
1293 if (tcp_lro_rx(&rxr->lro, m, 0) == 0)
1294 return;
1295 }
1283 /*
1284 * ATM LRO is only for IPv4/TCP packets and TCP checksum of the packet
1285 * should be computed by hardware. Also it should not have VLAN tag in
1286 * ethernet header.
1287 */
1288 if (rxr->lro_enabled &&
1289 (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
1290 (m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) ==
1291 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) {
1292 /*
1293 * Send to the stack if:
1294 ** - LRO not enabled, or
1295 ** - no LRO resources, or
1296 ** - lro enqueue fails
1297 */
1298 if (rxr->lro.lro_cnt != 0)
1299 if (tcp_lro_rx(&rxr->lro, m, 0) == 0)
1300 return;
1301 }
1302#endif
1296 IXL_RX_UNLOCK(rxr);
1297 (*ifp->if_input)(ifp, m);
1298 IXL_RX_LOCK(rxr);
1299}
1300
1301
1302static __inline void
1303ixl_rx_discard(struct rx_ring *rxr, int i)

--- 41 unchanged lines hidden (view full) ---

1345 * Return TRUE for more work, FALSE for all clean.
1346 *********************************************************************/
1347bool
1348ixl_rxeof(struct ixl_queue *que, int count)
1349{
1350 struct ixl_vsi *vsi = que->vsi;
1351 struct rx_ring *rxr = &que->rxr;
1352 struct ifnet *ifp = vsi->ifp;
1303 IXL_RX_UNLOCK(rxr);
1304 (*ifp->if_input)(ifp, m);
1305 IXL_RX_LOCK(rxr);
1306}
1307
1308
1309static __inline void
1310ixl_rx_discard(struct rx_ring *rxr, int i)

--- 41 unchanged lines hidden (view full) ---

1352 * Return TRUE for more work, FALSE for all clean.
1353 *********************************************************************/
1354bool
1355ixl_rxeof(struct ixl_queue *que, int count)
1356{
1357 struct ixl_vsi *vsi = que->vsi;
1358 struct rx_ring *rxr = &que->rxr;
1359 struct ifnet *ifp = vsi->ifp;
1360#if defined(INET6) || defined(INET)
1353 struct lro_ctrl *lro = &rxr->lro;
1354 struct lro_entry *queued;
1361 struct lro_ctrl *lro = &rxr->lro;
1362 struct lro_entry *queued;
1363#endif
1355 int i, nextp, processed = 0;
1356 union i40e_rx_desc *cur;
1357 struct ixl_rx_buf *rbuf, *nbuf;
1358
1359
1360 IXL_RX_LOCK(rxr);
1361
1362 for (i = rxr->next_check; count != 0;) {

--- 191 unchanged lines hidden (view full) ---

1554 }
1555
1556 /* Refresh any remaining buf structs */
1557 if (ixl_rx_unrefreshed(que))
1558 ixl_refresh_mbufs(que, i);
1559
1560 rxr->next_check = i;
1561
1364 int i, nextp, processed = 0;
1365 union i40e_rx_desc *cur;
1366 struct ixl_rx_buf *rbuf, *nbuf;
1367
1368
1369 IXL_RX_LOCK(rxr);
1370
1371 for (i = rxr->next_check; count != 0;) {

--- 191 unchanged lines hidden (view full) ---

1563 }
1564
1565 /* Refresh any remaining buf structs */
1566 if (ixl_rx_unrefreshed(que))
1567 ixl_refresh_mbufs(que, i);
1568
1569 rxr->next_check = i;
1570
1571#if defined(INET6) || defined(INET)
1562 /*
1563 * Flush any outstanding LRO work
1564 */
1565 while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) {
1566 SLIST_REMOVE_HEAD(&lro->lro_active, next);
1567 tcp_lro_flush(lro, queued);
1568 }
1572 /*
1573 * Flush any outstanding LRO work
1574 */
1575 while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) {
1576 SLIST_REMOVE_HEAD(&lro->lro_active, next);
1577 tcp_lro_flush(lro, queued);
1578 }
1579#endif
1569
1570 IXL_RX_UNLOCK(rxr);
1571 return (FALSE);
1572}
1573
1574
1575/*********************************************************************
1576 *

--- 40 unchanged lines hidden ---
1580
1581 IXL_RX_UNLOCK(rxr);
1582 return (FALSE);
1583}
1584
1585
1586/*********************************************************************
1587 *

--- 40 unchanged lines hidden ---