cxgb3 - Add SW LRO support
Subsystems (2)
PATCH 7/7 cxgb3 - Add SW LRO support
From: Divy Le Ray <[email protected]>
Add all-in-sw lro support.
Signed-off-by Divy Le Ray <[email protected]>
---
drivers/net/cxgb3/adapter.h | 21 ++ drivers/net/cxgb3/common.h | 1 drivers/net/cxgb3/cxgb3_ioctl.h | 1 drivers/net/cxgb3/cxgb3_main.c | 16 ++ drivers/net/cxgb3/sge.c | 341 ++++++++++++++++++++++++++++++++++++++- drivers/net/cxgb3/t3_cpl.h | 10 + 6 files changed, 384 insertions(+), 6 deletions(-)
drivers/net/cxgb3/adapter.h +21 -0
@@ -95,6 +95,23 @@ struct sge_fl { /* SGE per free-bufferunsigned long alloc_failed;/* # of times buffer allocation failed */ }; +/* Max active LRO sessions per queue set */ +#define MAX_LRO_PER_QSET 8 + +struct sge_lro_session { +struct sk_buff *skb; +struct sk_buff *skb_last_frag; +u32 seq; +u16 iplen; +}; + +struct sge_lro { +unsigned int enabled; +unsigned int num_active; +struct sge_lro_session *last_s; +struct sge_lro_session s[MAX_LRO_PER_QSET ]; +}; +/* * Bundle size for grouping offload RX packets for delivery to the stack. * Don't make this too big as we do prefetch on each packet in a bundle.
@@ -164,6 +181,9 @@ enum { /* per port SGE statistics */SGE_PSTAT_TX_CSUM ,/* # of TX checksum offloads */ SGE_PSTAT_VLANEX ,/* # of VLAN tag extractions */ SGE_PSTAT_VLANINS ,/* # of VLAN tag insertions */ +SGE_PSTATS_LRO_QUEUED ,/* # of LRO appended packets */ +SGE_PSTATS_LRO_FLUSHED ,/* # of LRO flushed packets */ +SGE_PSTATS_LRO_X_STREAMS ,/* # of exceeded LRO contexts */ SGE_PSTAT_MAX /* must be last */ };
@@ -171,6 +191,7 @@ enum { /* per port SGE statistics */struct sge_qset {/* an SGE queue set */ struct sge_rspq rspq;struct sge_fl fl[SGE_RXQ_PER_SET ]; +struct sge_lro lro;struct sge_txq txq[SGE_TXQ_PER_SET ];struct net_device *netdev;/* associated net device */ unsigned long txq_stopped;/* which Tx queues are stopped */
drivers/net/cxgb3/common.h +1 -0
@@ -322,6 +322,7 @@ struct tp_params {struct qset_params {/* SGE queue set parameters */ unsigned int polling;/* polling/interrupt service for rspq */ +unsigned int lro;/* large receive offload */ unsigned int coalesce_usecs;/* irq coalescing timer */ unsigned int rspq_size;/* # of entries in response queue */ unsigned int fl_size;/* # of entries in regular free list */
drivers/net/cxgb3/cxgb3_ioctl.h +1 -0
@@ -90,6 +90,7 @@ struct ch_qset_params {int32_t fl_size[2 ];int32_t intr_lat;int32_t polling; +int32_t lro;int32_t cong_thres; };
drivers/net/cxgb3/cxgb3_main.c +15 -1
@@ -1031,7 +1031,11 @@ static char stats_strings[][ETH_GSTRING_"VLANinsertions " ,"TxCsumOffload " ,"RxCsumGood " , - "RxDrops " +"RxDrops " , + +"LroQueued " , +"LroFlushed " , + "LroExceededSessions" };static int get_stats_count (struct net_device *dev)
@@ -1145,6 +1149,9 @@ static void get_stats(struct net_device *data++ =collect_sge_port_stats (adapter, pi,SGE_PSTAT_TX_CSUM ); *data++ =collect_sge_port_stats (adapter, pi,SGE_PSTAT_RX_CSUM_GOOD ); *data++ = s->rx_cong_drops; + *data++ =collect_sge_port_stats (adapter, pi,SGE_PSTATS_LRO_QUEUED ); + *data++ =collect_sge_port_stats (adapter, pi,SGE_PSTATS_LRO_FLUSHED ); + *data++ =collect_sge_port_stats (adapter, pi,SGE_PSTATS_LRO_X_STREAMS ); } static inline void reg_block_dump(struct adapter *ap, void *buf,
@@ -1624,6 +1631,12 @@ static int cxgb_extension_ioctl(struct n } } } +if (t.lro >=0 ) { +struct sge_qset *qs = &adapter->sge.qs[t.qset_idx]; + + q->lro = t.lro; + qs->lro.enabled = t.lro; + }break ; }case CHELSIO_GET_QSET_PARAMS :{
@@ -1643,6 +1656,7 @@ static int cxgb_extension_ioctl(struct n t.fl_size[0 ] = q->fl_size; t.fl_size[1 ] = q->jumbo_size; t.polling = q->polling; + t.lro = q->lro; t.intr_lat = q->coalesce_usecs; t.cong_thres = q->cong_thres;
drivers/net/cxgb3/sge.c +336 -5
389 lines not on this page · raw message
drivers/net/cxgb3/t3_cpl.h +10 -0
@@ -174,6 +174,12 @@ enum { /* TCP congestion control algoCONG_ALG_HIGHSPEED }; +enum {/* RSS hash type */ +RSS_HASH_NONE =0 , +RSS_HASH_2_TUPLE =1 <<0 , +RSS_HASH_4_TUPLE =1 <<1 +}; +union opcode_tid {__be32 opcode_tid;__u8 opcode;
@@ -184,6 +190,10 @@ union opcode_tid {#define G_OPCODE (x) (((x) >> S_OPCODE) & 0xFF)#define G_TID (x) ((x) & 0xFFFFFF) +#define S_HASHTYPE 22 +#define M_HASHTYPE 0x3 +#define G_HASHTYPE (x) (((x) >> S_HASHTYPE) & M_HASHTYPE) +/* tid is assumed to be 24-bits */ #define MK_OPCODE_TID (opcode, tid) (V_OPCODE(opcode) | (tid))