cxgb4i: fix tx immediate data credit check
Only data skbs need the wr header added while control skbs do not. Make sure they are treated differently. Signed-off-by: Karen Xie <kxie@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
37e9a69045
commit
84944d8cf5
@ -172,10 +172,14 @@ static int push_tx_frames(struct cxgbi_sock *, int);
|
|||||||
* Returns true if a packet can be sent as an offload WR with immediate
|
* Returns true if a packet can be sent as an offload WR with immediate
|
||||||
* data. We currently use the same limit as for Ethernet packets.
|
* data. We currently use the same limit as for Ethernet packets.
|
||||||
*/
|
*/
|
||||||
static inline int is_ofld_imm(const struct sk_buff *skb)
|
static inline bool is_ofld_imm(const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return skb->len <= (MAX_IMM_TX_PKT_LEN -
|
int len = skb->len;
|
||||||
sizeof(struct fw_ofld_tx_data_wr));
|
|
||||||
|
if (likely(cxgbi_skcb_test_flag(skb, SKCBF_TX_NEED_HDR)))
|
||||||
|
len += sizeof(struct fw_ofld_tx_data_wr);
|
||||||
|
|
||||||
|
return len <= MAX_IMM_TX_PKT_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
|
static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
|
||||||
@ -600,11 +604,15 @@ static int push_tx_frames(struct cxgbi_sock *csk, int req_completion)
|
|||||||
|
|
||||||
skb_reset_transport_header(skb);
|
skb_reset_transport_header(skb);
|
||||||
if (is_ofld_imm(skb))
|
if (is_ofld_imm(skb))
|
||||||
credits_needed = DIV_ROUND_UP(dlen +
|
credits_needed = DIV_ROUND_UP(dlen, 16);
|
||||||
sizeof(struct fw_ofld_tx_data_wr), 16);
|
|
||||||
else
|
else
|
||||||
credits_needed = DIV_ROUND_UP(8*calc_tx_flits_ofld(skb)
|
credits_needed = DIV_ROUND_UP(
|
||||||
+ sizeof(struct fw_ofld_tx_data_wr),
|
8 * calc_tx_flits_ofld(skb),
|
||||||
|
16);
|
||||||
|
|
||||||
|
if (likely(cxgbi_skcb_test_flag(skb, SKCBF_TX_NEED_HDR)))
|
||||||
|
credits_needed += DIV_ROUND_UP(
|
||||||
|
sizeof(struct fw_ofld_tx_data_wr),
|
||||||
16);
|
16);
|
||||||
|
|
||||||
if (csk->wr_cred < credits_needed) {
|
if (csk->wr_cred < credits_needed) {
|
||||||
|
@ -317,8 +317,8 @@ static inline void cxgbi_skcb_clear_flag(struct sk_buff *skb,
|
|||||||
__clear_bit(flag, &(cxgbi_skcb_flags(skb)));
|
__clear_bit(flag, &(cxgbi_skcb_flags(skb)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int cxgbi_skcb_test_flag(struct sk_buff *skb,
|
static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
|
||||||
enum cxgbi_skcb_flags flag)
|
enum cxgbi_skcb_flags flag)
|
||||||
{
|
{
|
||||||
return test_bit(flag, &(cxgbi_skcb_flags(skb)));
|
return test_bit(flag, &(cxgbi_skcb_flags(skb)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user