Deleted Added
sdiff udiff text old ( 270919 ) new ( 272313 )
full compact
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 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{
1088 struct rx_ring *rxr = &que->rxr;
1089#if defined(INET6) || defined(INET)
1090 struct ixl_vsi *vsi = que->vsi;
1091 struct ifnet *ifp = vsi->ifp;
1092 struct lro_ctrl *lro = &rxr->lro;
1093#endif
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)
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
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)
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
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)
1361 struct lro_ctrl *lro = &rxr->lro;
1362 struct lro_entry *queued;
1363#endif
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)
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
1580
1581 IXL_RX_UNLOCK(rxr);
1582 return (FALSE);
1583}
1584
1585
1586/*********************************************************************
1587 *

--- 40 unchanged lines hidden ---