diff options
author | Ravinandan Arakali <Ravinandan.Arakali@neterion.com> | 2006-01-25 14:53:07 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 10:34:38 -0500 |
commit | 7d3d0439f574a4857c97b3ad2e63b082b7382d7e (patch) | |
tree | 320e1024829ee4939f9d66d5bcddcdb43258cbcb /drivers/net/s2io.h | |
parent | efd51b5c6798d103e3aa683464aebb2019b62119 (diff) |
[PATCH] S2io: Large Receive Offload (LRO) feature(v2) for Neterion (s2io) 10GbE Xframe PCI-X and PCI-E NICs
Hi,
Below is a patch for the Large Receive Offload feature.
Please review and let us know your comments.
LRO algorithm was described in an OLS 2005 presentation, located at
ftp.s2io.com
user: linuxdocs
password: HALdocs
The same ftp site has Programming Manual for Xframe-I ASIC.
LRO feature is supported on Neterion Xframe-I, Xframe-II and
Xframe-Express 10GbE NICs.
Brief description:
The Large Receive Offload(LRO) feature is a stateless offload
that is complementary to TSO feature but on the receive path.
The idea is to combine and collapse(upto 64K maximum) in the
driver, in-sequence TCP packets belonging to the same session.
It is mainly designed to improve 1500 mtu receive performance,
since Jumbo frame performance is already close to 10GbE line
rate. Some performance numbers are attached below.
Implementation details:
1. Handle packet chains from multiple sessions(current default
MAX_LRO_SESSSIONS=32).
2. Examine each packet for eligiblity to aggregate. A packet is
considered eligible if it meets all the below criteria.
a. It is a TCP/IP packet and L2 type is not LLC or SNAP.
b. The packet has no checksum errors(L3 and L4).
c. There are no IP options. The only TCP option supported is timestamps.
d. Search and locate the LRO object corresponding to this
socket and ensure packet is in TCP sequence.
e. It's not a special packet(SYN, FIN, RST, URG, PSH etc. flags are not set).
f. TCP payload is non-zero(It's not a pure ACK).
g. It's not an IP-fragmented packet.
3. If a packet is found eligible, the LRO object is updated with
information such as next sequence number expected, current length
of aggregated packet and so on. If not eligible or max packets
reached, update IP and TCP headers of first packet in the chain
and pass it up to stack.
4. The frag_list in skb structure is used to chain packets into one
large packet.
Kernel changes required: None
Performance results:
Main focus of the initial testing was on 1500 mtu receiver, since this
is a bottleneck not covered by the existing stateless offloads.
There are couple disclaimers about the performance results below:
1. Your mileage will vary!!!! We initially concentrated on couple pci-x
2.0 platforms that are powerful enough to push 10 GbE NIC and do not
have bottlenecks other than cpu%; testing on other platforms is still
in progress. On some lower end systems we are seeing lower gains.
2. Current LRO implementation is still (for the most part) software based,
and therefore performance potential of the feature is far from being realized.
Full hw implementation of LRO is expected in the next version of Xframe ASIC.
Performance delta(with MTU=1500) going from LRO disabled to enabled:
IBM 2-way Xeon (x366) : 3.5 to 7.1 Gbps
2-way Opteron : 4.5 to 6.1 Gbps
Signed-off-by: Ravinandan Arakali <ravinandan.arakali@neterion.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/s2io.h')
-rw-r--r-- | drivers/net/s2io.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 852a6a899d07..65cc59ac71f0 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -78,6 +78,13 @@ int debug_level = ERR_DBG; /* Default level. */ | |||
78 | typedef struct { | 78 | typedef struct { |
79 | unsigned long long single_ecc_errs; | 79 | unsigned long long single_ecc_errs; |
80 | unsigned long long double_ecc_errs; | 80 | unsigned long long double_ecc_errs; |
81 | /* LRO statistics */ | ||
82 | unsigned long long clubbed_frms_cnt; | ||
83 | unsigned long long sending_both; | ||
84 | unsigned long long outof_sequence_pkts; | ||
85 | unsigned long long flush_max_pkts; | ||
86 | unsigned long long sum_avg_pkts_aggregated; | ||
87 | unsigned long long num_aggregations; | ||
81 | } swStat_t; | 88 | } swStat_t; |
82 | 89 | ||
83 | /* The statistics block of Xena */ | 90 | /* The statistics block of Xena */ |
@@ -680,6 +687,24 @@ struct msix_info_st { | |||
680 | u64 data; | 687 | u64 data; |
681 | }; | 688 | }; |
682 | 689 | ||
690 | /* Data structure to represent a LRO session */ | ||
691 | typedef struct lro { | ||
692 | struct sk_buff *parent; | ||
693 | u8 *l2h; | ||
694 | struct iphdr *iph; | ||
695 | struct tcphdr *tcph; | ||
696 | u32 tcp_next_seq; | ||
697 | u32 tcp_ack; | ||
698 | int total_len; | ||
699 | int frags_len; | ||
700 | int sg_num; | ||
701 | int in_use; | ||
702 | u16 window; | ||
703 | u32 cur_tsval; | ||
704 | u32 cur_tsecr; | ||
705 | u8 saw_ts; | ||
706 | }lro_t; | ||
707 | |||
683 | /* Structure representing one instance of the NIC */ | 708 | /* Structure representing one instance of the NIC */ |
684 | struct s2io_nic { | 709 | struct s2io_nic { |
685 | int rxd_mode; | 710 | int rxd_mode; |
@@ -784,6 +809,13 @@ struct s2io_nic { | |||
784 | #define XFRAME_II_DEVICE 2 | 809 | #define XFRAME_II_DEVICE 2 |
785 | u8 device_type; | 810 | u8 device_type; |
786 | 811 | ||
812 | #define MAX_LRO_SESSIONS 32 | ||
813 | lro_t lro0_n[MAX_LRO_SESSIONS]; | ||
814 | unsigned long clubbed_frms_cnt; | ||
815 | unsigned long sending_both; | ||
816 | u8 lro; | ||
817 | u16 lro_max_aggr_per_sess; | ||
818 | |||
787 | #define INTA 0 | 819 | #define INTA 0 |
788 | #define MSI 1 | 820 | #define MSI 1 |
789 | #define MSI_X 2 | 821 | #define MSI_X 2 |
@@ -940,4 +972,10 @@ static void s2io_card_down(nic_t *nic); | |||
940 | static int s2io_card_up(nic_t *nic); | 972 | static int s2io_card_up(nic_t *nic); |
941 | int get_xena_rev_id(struct pci_dev *pdev); | 973 | int get_xena_rev_id(struct pci_dev *pdev); |
942 | void restore_xmsi_data(nic_t *nic); | 974 | void restore_xmsi_data(nic_t *nic); |
975 | |||
976 | static int s2io_club_tcp_session(u8 *buffer, u8 **tcp, u32 *tcp_len, lro_t **lro, RxD_t *rxdp, nic_t *sp); | ||
977 | static void clear_lro_session(lro_t *lro); | ||
978 | static void queue_rx_frame(struct sk_buff *skb); | ||
979 | static void update_L3L4_header(nic_t *sp, lro_t *lro); | ||
980 | static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb, u32 tcp_len); | ||
943 | #endif /* _S2IO_H */ | 981 | #endif /* _S2IO_H */ |