aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c22
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h4
2 files changed, 17 insertions, 9 deletions
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 69fbfc89efb6..8abe8a303386 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -172,10 +172,14 @@ static int push_tx_frames(struct cxgbi_sock *, int);
172 * Returns true if a packet can be sent as an offload WR with immediate 172 * Returns true if a packet can be sent as an offload WR with immediate
173 * data. We currently use the same limit as for Ethernet packets. 173 * data. We currently use the same limit as for Ethernet packets.
174 */ 174 */
175static inline int is_ofld_imm(const struct sk_buff *skb) 175static inline bool is_ofld_imm(const struct sk_buff *skb)
176{ 176{
177 return skb->len <= (MAX_IMM_TX_PKT_LEN - 177 int len = skb->len;
178 sizeof(struct fw_ofld_tx_data_wr)); 178
179 if (likely(cxgbi_skcb_test_flag(skb, SKCBF_TX_NEED_HDR)))
180 len += sizeof(struct fw_ofld_tx_data_wr);
181
182 return len <= MAX_IMM_TX_PKT_LEN;
179} 183}
180 184
181static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, 185static 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)
600 604
601 skb_reset_transport_header(skb); 605 skb_reset_transport_header(skb);
602 if (is_ofld_imm(skb)) 606 if (is_ofld_imm(skb))
603 credits_needed = DIV_ROUND_UP(dlen + 607 credits_needed = DIV_ROUND_UP(dlen, 16);
604 sizeof(struct fw_ofld_tx_data_wr), 16);
605 else 608 else
606 credits_needed = DIV_ROUND_UP(8*calc_tx_flits_ofld(skb) 609 credits_needed = DIV_ROUND_UP(
607 + sizeof(struct fw_ofld_tx_data_wr), 610 8 * calc_tx_flits_ofld(skb),
611 16);
612
613 if (likely(cxgbi_skcb_test_flag(skb, SKCBF_TX_NEED_HDR)))
614 credits_needed += DIV_ROUND_UP(
615 sizeof(struct fw_ofld_tx_data_wr),
608 16); 616 16);
609 617
610 if (csk->wr_cred < credits_needed) { 618 if (csk->wr_cred < credits_needed) {
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 2c7cb1c0c453..aba1af720df6 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -317,8 +317,8 @@ static inline void cxgbi_skcb_clear_flag(struct sk_buff *skb,
317 __clear_bit(flag, &(cxgbi_skcb_flags(skb))); 317 __clear_bit(flag, &(cxgbi_skcb_flags(skb)));
318} 318}
319 319
320static inline int cxgbi_skcb_test_flag(struct sk_buff *skb, 320static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
321 enum cxgbi_skcb_flags flag) 321 enum cxgbi_skcb_flags flag)
322{ 322{
323 return test_bit(flag, &(cxgbi_skcb_flags(skb))); 323 return test_bit(flag, &(cxgbi_skcb_flags(skb)));
324} 324}