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 270919 2014-09-01 07:54:30Z jfv $*/
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 ixl_vsi *vsi = que->vsi;
1089 struct ifnet *ifp = vsi->ifp;
1090 struct rx_ring *rxr = &que->rxr;
1091 struct lro_ctrl *lro = &rxr->lro;
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
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 }
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{
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 }
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;
1353 struct lro_ctrl *lro = &rxr->lro;
1354 struct lro_entry *queued;
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
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 }
1569
1570 IXL_RX_UNLOCK(rxr);
1571 return (FALSE);
1572}
1573
1574
1575/*********************************************************************
1576 *

--- 40 unchanged lines hidden ---