cxgb_sge.c (237263) | cxgb_sge.c (237832) |
---|---|
1/************************************************************************** 2 3Copyright (c) 2007-2009, Chelsio Inc. 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions are met: 8 --- 14 unchanged lines hidden (view full) --- 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26POSSIBILITY OF SUCH DAMAGE. 27 28***************************************************************************/ 29 30#include <sys/cdefs.h> | 1/************************************************************************** 2 3Copyright (c) 2007-2009, Chelsio Inc. 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions are met: 8 --- 14 unchanged lines hidden (view full) --- 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26POSSIBILITY OF SUCH DAMAGE. 27 28***************************************************************************/ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/cxgb/cxgb_sge.c 237263 2012-06-19 07:34:13Z np $"); | 31__FBSDID("$FreeBSD: head/sys/dev/cxgb/cxgb_sge.c 237832 2012-06-30 02:11:53Z np $"); |
32 33#include "opt_inet6.h" 34#include "opt_inet.h" 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/module.h> --- 1387 unchanged lines hidden (view full) --- 1427 uint32_t *hflit = (uint32_t *)&flit; 1428 int cflags = m0->m_pkthdr.csum_flags; 1429 1430 cntrl = V_TXPKT_INTF(pi->txpkt_intf); 1431 GET_VTAG(cntrl, m0); 1432 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); 1433 if (__predict_false(!(cflags & CSUM_IP))) 1434 cntrl |= F_TXPKT_IPCSUM_DIS; | 32 33#include "opt_inet6.h" 34#include "opt_inet.h" 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/module.h> --- 1387 unchanged lines hidden (view full) --- 1427 uint32_t *hflit = (uint32_t *)&flit; 1428 int cflags = m0->m_pkthdr.csum_flags; 1429 1430 cntrl = V_TXPKT_INTF(pi->txpkt_intf); 1431 GET_VTAG(cntrl, m0); 1432 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); 1433 if (__predict_false(!(cflags & CSUM_IP))) 1434 cntrl |= F_TXPKT_IPCSUM_DIS; |
1435 if (__predict_false(!(cflags & (CSUM_TCP | CSUM_UDP)))) | 1435 if (__predict_false(!(cflags & (CSUM_TCP | CSUM_UDP | 1436 CSUM_UDP_IPV6 | CSUM_TCP_IPV6)))) |
1436 cntrl |= F_TXPKT_L4CSUM_DIS; 1437 1438 hflit[0] = htonl(cntrl); 1439 hflit[1] = htonl(segs[i].ds_len | 0x80000000); 1440 flit |= htobe64(1 << 24); 1441 cbe = &cpl_batch->pkt_entry[i]; 1442 cbe->cntrl = hflit[0]; 1443 cbe->len = hflit[1]; --- 98 unchanged lines hidden (view full) --- 1542 flits = 3; 1543 } else { 1544 struct cpl_tx_pkt *cpl = (struct cpl_tx_pkt *)txd; 1545 1546 GET_VTAG(cntrl, m0); 1547 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); 1548 if (__predict_false(!(m0->m_pkthdr.csum_flags & CSUM_IP))) 1549 cntrl |= F_TXPKT_IPCSUM_DIS; | 1437 cntrl |= F_TXPKT_L4CSUM_DIS; 1438 1439 hflit[0] = htonl(cntrl); 1440 hflit[1] = htonl(segs[i].ds_len | 0x80000000); 1441 flit |= htobe64(1 << 24); 1442 cbe = &cpl_batch->pkt_entry[i]; 1443 cbe->cntrl = hflit[0]; 1444 cbe->len = hflit[1]; --- 98 unchanged lines hidden (view full) --- 1543 flits = 3; 1544 } else { 1545 struct cpl_tx_pkt *cpl = (struct cpl_tx_pkt *)txd; 1546 1547 GET_VTAG(cntrl, m0); 1548 cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); 1549 if (__predict_false(!(m0->m_pkthdr.csum_flags & CSUM_IP))) 1550 cntrl |= F_TXPKT_IPCSUM_DIS; |
1550 if (__predict_false(!(m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)))) | 1551 if (__predict_false(!(m0->m_pkthdr.csum_flags & (CSUM_TCP | 1552 CSUM_UDP | CSUM_UDP_IPV6 | CSUM_TCP_IPV6)))) |
1551 cntrl |= F_TXPKT_L4CSUM_DIS; 1552 cpl->cntrl = htonl(cntrl); 1553 cpl->len = htonl(mlen | 0x80000000); 1554 1555 if (mlen <= PIO_LEN) { 1556 txsd->m = NULL; 1557 m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); 1558 flits = (mlen + 7) / 8 + 2; --- 1056 unchanged lines hidden (view full) --- 2615} 2616 2617/* 2618 * Remove CPL_RX_PKT headers from the mbuf and reduce it to a regular mbuf with 2619 * ethernet data. Hardware assistance with various checksums and any vlan tag 2620 * will also be taken into account here. 2621 */ 2622void | 1553 cntrl |= F_TXPKT_L4CSUM_DIS; 1554 cpl->cntrl = htonl(cntrl); 1555 cpl->len = htonl(mlen | 0x80000000); 1556 1557 if (mlen <= PIO_LEN) { 1558 txsd->m = NULL; 1559 m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); 1560 flits = (mlen + 7) / 8 + 2; --- 1056 unchanged lines hidden (view full) --- 2617} 2618 2619/* 2620 * Remove CPL_RX_PKT headers from the mbuf and reduce it to a regular mbuf with 2621 * ethernet data. Hardware assistance with various checksums and any vlan tag 2622 * will also be taken into account here. 2623 */ 2624void |
2623t3_rx_eth(struct adapter *adap, struct sge_rspq *rq, struct mbuf *m, int ethpad) | 2625t3_rx_eth(struct adapter *adap, struct mbuf *m, int ethpad) |
2624{ 2625 struct cpl_rx_pkt *cpl = (struct cpl_rx_pkt *)(mtod(m, uint8_t *) + ethpad); 2626 struct port_info *pi = &adap->port[adap->rxpkt_map[cpl->iff]]; 2627 struct ifnet *ifp = pi->ifp; 2628 | 2626{ 2627 struct cpl_rx_pkt *cpl = (struct cpl_rx_pkt *)(mtod(m, uint8_t *) + ethpad); 2628 struct port_info *pi = &adap->port[adap->rxpkt_map[cpl->iff]]; 2629 struct ifnet *ifp = pi->ifp; 2630 |
2629 if ((ifp->if_capenable & IFCAP_RXCSUM) && !cpl->fragment && 2630 cpl->csum_valid && cpl->csum == 0xffff) { 2631 m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED|CSUM_IP_VALID); 2632 rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++; 2633 m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED|CSUM_IP_VALID|CSUM_DATA_VALID|CSUM_PSEUDO_HDR); 2634 m->m_pkthdr.csum_data = 0xffff; 2635 } 2636 | |
2637 if (cpl->vlan_valid) { 2638 m->m_pkthdr.ether_vtag = ntohs(cpl->vlan); 2639 m->m_flags |= M_VLANTAG; 2640 } 2641 2642 m->m_pkthdr.rcvif = ifp; 2643 m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; 2644 /* 2645 * adjust after conversion to mbuf chain 2646 */ 2647 m->m_pkthdr.len -= (sizeof(*cpl) + ethpad); 2648 m->m_len -= (sizeof(*cpl) + ethpad); 2649 m->m_data += (sizeof(*cpl) + ethpad); | 2631 if (cpl->vlan_valid) { 2632 m->m_pkthdr.ether_vtag = ntohs(cpl->vlan); 2633 m->m_flags |= M_VLANTAG; 2634 } 2635 2636 m->m_pkthdr.rcvif = ifp; 2637 m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; 2638 /* 2639 * adjust after conversion to mbuf chain 2640 */ 2641 m->m_pkthdr.len -= (sizeof(*cpl) + ethpad); 2642 m->m_len -= (sizeof(*cpl) + ethpad); 2643 m->m_data += (sizeof(*cpl) + ethpad); |
2644 2645 if (!cpl->fragment && cpl->csum_valid && cpl->csum == 0xffff) { 2646 struct ether_header *eh = mtod(m, void *); 2647 uint16_t eh_type; 2648 2649 if (eh->ether_type == htons(ETHERTYPE_VLAN)) { 2650 struct ether_vlan_header *evh = mtod(m, void *); 2651 2652 eh_type = evh->evl_proto; 2653 } else 2654 eh_type = eh->ether_type; 2655 2656 if (ifp->if_capenable & IFCAP_RXCSUM && 2657 eh_type == htons(ETHERTYPE_IP)) { 2658 m->m_pkthdr.csum_flags = (CSUM_IP_CHECKED | 2659 CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR); 2660 m->m_pkthdr.csum_data = 0xffff; 2661 } else if (ifp->if_capenable & IFCAP_RXCSUM_IPV6 && 2662 eh_type == htons(ETHERTYPE_IPV6)) { 2663 m->m_pkthdr.csum_flags = (CSUM_DATA_VALID_IPV6 | 2664 CSUM_PSEUDO_HDR); 2665 m->m_pkthdr.csum_data = 0xffff; 2666 } 2667 } |
|
2650} 2651 2652/** 2653 * get_packet - return the next ingress packet buffer from a free list 2654 * @adap: the adapter that received the packet 2655 * @drop_thres: # of remaining buffers before we start dropping packets 2656 * @qs: the qset that the SGE free list holding the packet belongs to 2657 * @mh: the mbuf header, contains a pointer to the head and tail of the mbuf chain --- 250 unchanged lines hidden (view full) --- 2908 adap->cpl_handler[opcode](qs, r, mh->mh_head); 2909#else 2910 m_freem(mh->mh_head); 2911#endif 2912 mh->mh_head = NULL; 2913 } else if (eth && eop) { 2914 struct mbuf *m = mh->mh_head; 2915 | 2668} 2669 2670/** 2671 * get_packet - return the next ingress packet buffer from a free list 2672 * @adap: the adapter that received the packet 2673 * @drop_thres: # of remaining buffers before we start dropping packets 2674 * @qs: the qset that the SGE free list holding the packet belongs to 2675 * @mh: the mbuf header, contains a pointer to the head and tail of the mbuf chain --- 250 unchanged lines hidden (view full) --- 2926 adap->cpl_handler[opcode](qs, r, mh->mh_head); 2927#else 2928 m_freem(mh->mh_head); 2929#endif 2930 mh->mh_head = NULL; 2931 } else if (eth && eop) { 2932 struct mbuf *m = mh->mh_head; 2933 |
2916 t3_rx_eth(adap, rspq, m, ethpad); | 2934 t3_rx_eth(adap, m, ethpad); |
2917 2918 /* 2919 * The T304 sends incoming packets on any qset. If LRO 2920 * is also enabled, we could end up sending packet up 2921 * lro_ctrl->ifp's input. That is incorrect. 2922 * 2923 * The mbuf's rcvif was derived from the cpl header and 2924 * is accurate. Skip LRO and just use that. --- 784 unchanged lines hidden --- | 2935 2936 /* 2937 * The T304 sends incoming packets on any qset. If LRO 2938 * is also enabled, we could end up sending packet up 2939 * lro_ctrl->ifp's input. That is incorrect. 2940 * 2941 * The mbuf's rcvif was derived from the cpl header and 2942 * is accurate. Skip LRO and just use that. --- 784 unchanged lines hidden --- |