cxgb_sge.c (6a068746777241722b2b32c5d0bc443a2a64d80b) | cxgb_sge.c (47cfa99a506970a13471405702e568f394ac8d1a) |
---|---|
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 --- 16 unchanged lines hidden (view full) --- 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$"); 32 | 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 --- 16 unchanged lines hidden (view full) --- 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$"); 32 |
33#include "opt_inet6.h" |
|
33#include "opt_inet.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/bus.h> 40#include <sys/conf.h> --- 2039 unchanged lines hidden (view full) --- 2080 2081 bus_dmamap_unload(q->rspq.desc_tag, q->rspq.desc_map); 2082 bus_dmamem_free(q->rspq.desc_tag, q->rspq.desc, 2083 q->rspq.desc_map); 2084 bus_dma_tag_destroy(q->rspq.desc_tag); 2085 MTX_DESTROY(&q->rspq.lock); 2086 } 2087 | 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> 40#include <sys/bus.h> 41#include <sys/conf.h> --- 2039 unchanged lines hidden (view full) --- 2081 2082 bus_dmamap_unload(q->rspq.desc_tag, q->rspq.desc_map); 2083 bus_dmamem_free(q->rspq.desc_tag, q->rspq.desc, 2084 q->rspq.desc_map); 2085 bus_dma_tag_destroy(q->rspq.desc_tag); 2086 MTX_DESTROY(&q->rspq.lock); 2087 } 2088 |
2088#ifdef INET | 2089#if defined(INET6) || defined(INET) |
2089 tcp_lro_free(&q->lro.ctrl); 2090#endif 2091 2092 bzero(q, sizeof(*q)); 2093} 2094 2095/** 2096 * t3_free_sge_resources - free SGE resources --- 566 unchanged lines hidden (view full) --- 2663 KASSERT(0, ("can't deal with jumbo_buf_size %d.", p->jumbo_buf_size)); 2664 ret = EDOOFUS; 2665 goto err; 2666 } 2667 q->fl[1].buf_size = p->jumbo_buf_size; 2668 2669 /* Allocate and setup the lro_ctrl structure */ 2670 q->lro.enabled = !!(pi->ifp->if_capenable & IFCAP_LRO); | 2090 tcp_lro_free(&q->lro.ctrl); 2091#endif 2092 2093 bzero(q, sizeof(*q)); 2094} 2095 2096/** 2097 * t3_free_sge_resources - free SGE resources --- 566 unchanged lines hidden (view full) --- 2664 KASSERT(0, ("can't deal with jumbo_buf_size %d.", p->jumbo_buf_size)); 2665 ret = EDOOFUS; 2666 goto err; 2667 } 2668 q->fl[1].buf_size = p->jumbo_buf_size; 2669 2670 /* Allocate and setup the lro_ctrl structure */ 2671 q->lro.enabled = !!(pi->ifp->if_capenable & IFCAP_LRO); |
2671#ifdef INET | 2672#if defined(INET6) || defined(INET) |
2672 ret = tcp_lro_init(&q->lro.ctrl); 2673 if (ret) { 2674 printf("error %d from tcp_lro_init\n", ret); 2675 goto err; 2676 } 2677#endif 2678 q->lro.ctrl.ifp = pi->ifp; 2679 --- 276 unchanged lines hidden (view full) --- 2956 */ 2957static int 2958process_responses(adapter_t *adap, struct sge_qset *qs, int budget) 2959{ 2960 struct sge_rspq *rspq = &qs->rspq; 2961 struct rsp_desc *r = &rspq->desc[rspq->cidx]; 2962 int budget_left = budget; 2963 unsigned int sleeping = 0; | 2673 ret = tcp_lro_init(&q->lro.ctrl); 2674 if (ret) { 2675 printf("error %d from tcp_lro_init\n", ret); 2676 goto err; 2677 } 2678#endif 2679 q->lro.ctrl.ifp = pi->ifp; 2680 --- 276 unchanged lines hidden (view full) --- 2957 */ 2958static int 2959process_responses(adapter_t *adap, struct sge_qset *qs, int budget) 2960{ 2961 struct sge_rspq *rspq = &qs->rspq; 2962 struct rsp_desc *r = &rspq->desc[rspq->cidx]; 2963 int budget_left = budget; 2964 unsigned int sleeping = 0; |
2965#if defined(INET6) || defined(INET) |
|
2964 int lro_enabled = qs->lro.enabled; 2965 int skip_lro; 2966 struct lro_ctrl *lro_ctrl = &qs->lro.ctrl; | 2966 int lro_enabled = qs->lro.enabled; 2967 int skip_lro; 2968 struct lro_ctrl *lro_ctrl = &qs->lro.ctrl; |
2969#endif |
|
2967 struct mbuf *offload_mbufs[RX_BUNDLE_SIZE]; 2968 int ngathered = 0; 2969 struct t3_mbuf_hdr *mh = &rspq->rspq_mh; 2970#ifdef DEBUG 2971 static int last_holdoff = 0; 2972 if (cxgb_debug && rspq->holdoff_tmr != last_holdoff) { 2973 printf("next_holdoff=%d\n", rspq->holdoff_tmr); 2974 last_holdoff = rspq->holdoff_tmr; --- 102 unchanged lines hidden (view full) --- 3077 /* 3078 * The T304 sends incoming packets on any qset. If LRO 3079 * is also enabled, we could end up sending packet up 3080 * lro_ctrl->ifp's input. That is incorrect. 3081 * 3082 * The mbuf's rcvif was derived from the cpl header and 3083 * is accurate. Skip LRO and just use that. 3084 */ | 2970 struct mbuf *offload_mbufs[RX_BUNDLE_SIZE]; 2971 int ngathered = 0; 2972 struct t3_mbuf_hdr *mh = &rspq->rspq_mh; 2973#ifdef DEBUG 2974 static int last_holdoff = 0; 2975 if (cxgb_debug && rspq->holdoff_tmr != last_holdoff) { 2976 printf("next_holdoff=%d\n", rspq->holdoff_tmr); 2977 last_holdoff = rspq->holdoff_tmr; --- 102 unchanged lines hidden (view full) --- 3080 /* 3081 * The T304 sends incoming packets on any qset. If LRO 3082 * is also enabled, we could end up sending packet up 3083 * lro_ctrl->ifp's input. That is incorrect. 3084 * 3085 * The mbuf's rcvif was derived from the cpl header and 3086 * is accurate. Skip LRO and just use that. 3087 */ |
3088#if defined(INET6) || defined(INET) |
|
3085 skip_lro = __predict_false(qs->port->ifp != m->m_pkthdr.rcvif); 3086 3087 if (lro_enabled && lro_ctrl->lro_cnt && !skip_lro | 3089 skip_lro = __predict_false(qs->port->ifp != m->m_pkthdr.rcvif); 3090 3091 if (lro_enabled && lro_ctrl->lro_cnt && !skip_lro |
3088#ifdef INET | |
3089 && (tcp_lro_rx(lro_ctrl, m, 0) == 0) | 3092 && (tcp_lro_rx(lro_ctrl, m, 0) == 0) |
3090#endif | |
3091 ) { 3092 /* successfully queue'd for LRO */ | 3093 ) { 3094 /* successfully queue'd for LRO */ |
3093 } else { | 3095 } else 3096#endif 3097 { |
3094 /* 3095 * LRO not enabled, packet unsuitable for LRO, 3096 * or unable to queue. Pass it up right now in 3097 * either case. 3098 */ 3099 struct ifnet *ifp = m->m_pkthdr.rcvif; 3100 (*ifp->if_input)(ifp, m); 3101 } 3102 mh->mh_head = NULL; 3103 3104 } 3105 __refill_fl_lt(adap, &qs->fl[0], 32); 3106 __refill_fl_lt(adap, &qs->fl[1], 32); 3107 --budget_left; 3108 } 3109 3110 deliver_partial_bundle(&adap->tdev, rspq, offload_mbufs, ngathered); 3111 | 3098 /* 3099 * LRO not enabled, packet unsuitable for LRO, 3100 * or unable to queue. Pass it up right now in 3101 * either case. 3102 */ 3103 struct ifnet *ifp = m->m_pkthdr.rcvif; 3104 (*ifp->if_input)(ifp, m); 3105 } 3106 mh->mh_head = NULL; 3107 3108 } 3109 __refill_fl_lt(adap, &qs->fl[0], 32); 3110 __refill_fl_lt(adap, &qs->fl[1], 32); 3111 --budget_left; 3112 } 3113 3114 deliver_partial_bundle(&adap->tdev, rspq, offload_mbufs, ngathered); 3115 |
3112#ifdef INET | 3116#if defined(INET6) || defined(INET) |
3113 /* Flush LRO */ 3114 while (!SLIST_EMPTY(&lro_ctrl->lro_active)) { 3115 struct lro_entry *queued = SLIST_FIRST(&lro_ctrl->lro_active); 3116 SLIST_REMOVE_HEAD(&lro_ctrl->lro_active, next); 3117 tcp_lro_flush(lro_ctrl, queued); 3118 } 3119#endif 3120 --- 736 unchanged lines hidden --- | 3117 /* Flush LRO */ 3118 while (!SLIST_EMPTY(&lro_ctrl->lro_active)) { 3119 struct lro_entry *queued = SLIST_FIRST(&lro_ctrl->lro_active); 3120 SLIST_REMOVE_HEAD(&lro_ctrl->lro_active, next); 3121 tcp_lro_flush(lro_ctrl, queued); 3122 } 3123#endif 3124 --- 736 unchanged lines hidden --- |