bnx2x: properly calculate lro_mss
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
63135281af
commit
e4e3c02a1a
@@ -259,10 +259,44 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Timestamp option length allowed for TPA aggregation:
|
||||||
|
*
|
||||||
|
* nop nop kind length echo val
|
||||||
|
*/
|
||||||
|
#define TPA_TSTAMP_OPT_LEN 12
|
||||||
|
/**
|
||||||
|
* Calculate the approximate value of the MSS for this
|
||||||
|
* aggregation using the first packet of it.
|
||||||
|
*
|
||||||
|
* @param bp
|
||||||
|
* @param parsing_flags Parsing flags from the START CQE
|
||||||
|
* @param len_on_bd Total length of the first packet for the
|
||||||
|
* aggregation.
|
||||||
|
*/
|
||||||
|
static inline u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags,
|
||||||
|
u16 len_on_bd)
|
||||||
|
{
|
||||||
|
/* TPA arrgregation won't have an IP options and TCP options
|
||||||
|
* other than timestamp.
|
||||||
|
*/
|
||||||
|
u16 hdrs_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct tcphdr);
|
||||||
|
|
||||||
|
|
||||||
|
/* Check if there was a TCP timestamp, if there is it's will
|
||||||
|
* always be 12 bytes length: nop nop kind length echo val.
|
||||||
|
*
|
||||||
|
* Otherwise FW would close the aggregation.
|
||||||
|
*/
|
||||||
|
if (parsing_flags & PARSING_FLAGS_TIME_STAMP_EXIST_FLAG)
|
||||||
|
hdrs_len += TPA_TSTAMP_OPT_LEN;
|
||||||
|
|
||||||
|
return len_on_bd - hdrs_len;
|
||||||
|
}
|
||||||
|
|
||||||
static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
|
static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb,
|
||||||
struct eth_fast_path_rx_cqe *fp_cqe,
|
struct eth_fast_path_rx_cqe *fp_cqe,
|
||||||
u16 cqe_idx)
|
u16 cqe_idx, u16 parsing_flags)
|
||||||
{
|
{
|
||||||
struct sw_rx_page *rx_pg, old_rx_pg;
|
struct sw_rx_page *rx_pg, old_rx_pg;
|
||||||
u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd);
|
u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd);
|
||||||
@@ -275,8 +309,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
|
|||||||
|
|
||||||
/* This is needed in order to enable forwarding support */
|
/* This is needed in order to enable forwarding support */
|
||||||
if (frag_size)
|
if (frag_size)
|
||||||
skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE,
|
skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp, parsing_flags,
|
||||||
max(frag_size, (u32)len_on_bd));
|
len_on_bd);
|
||||||
|
|
||||||
#ifdef BNX2X_STOP_ON_ERROR
|
#ifdef BNX2X_STOP_ON_ERROR
|
||||||
if (pages > min_t(u32, 8, MAX_SKB_FRAGS)*SGE_PAGE_SIZE*PAGES_PER_SGE) {
|
if (pages > min_t(u32, 8, MAX_SKB_FRAGS)*SGE_PAGE_SIZE*PAGES_PER_SGE) {
|
||||||
@@ -344,6 +378,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
|
|||||||
if (likely(new_skb)) {
|
if (likely(new_skb)) {
|
||||||
/* fix ip xsum and give it to the stack */
|
/* fix ip xsum and give it to the stack */
|
||||||
/* (no need to map the new skb) */
|
/* (no need to map the new skb) */
|
||||||
|
u16 parsing_flags =
|
||||||
|
le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags);
|
||||||
|
|
||||||
prefetch(skb);
|
prefetch(skb);
|
||||||
prefetch(((char *)(skb)) + L1_CACHE_BYTES);
|
prefetch(((char *)(skb)) + L1_CACHE_BYTES);
|
||||||
@@ -373,9 +409,9 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!bnx2x_fill_frag_skb(bp, fp, skb,
|
if (!bnx2x_fill_frag_skb(bp, fp, skb,
|
||||||
&cqe->fast_path_cqe, cqe_idx)) {
|
&cqe->fast_path_cqe, cqe_idx,
|
||||||
if ((le16_to_cpu(cqe->fast_path_cqe.
|
parsing_flags)) {
|
||||||
pars_flags.flags) & PARSING_FLAGS_VLAN))
|
if (parsing_flags & PARSING_FLAGS_VLAN)
|
||||||
__vlan_hwaccel_put_tag(skb,
|
__vlan_hwaccel_put_tag(skb,
|
||||||
le16_to_cpu(cqe->fast_path_cqe.
|
le16_to_cpu(cqe->fast_path_cqe.
|
||||||
vlan_tag));
|
vlan_tag));
|
||||||
|
Reference in New Issue
Block a user