* [PATCH net v8 1/7] cxgb4i: fix tx immediate data credit check
@ 2014-12-10 21:11 Karen Xie
2014-12-11 3:54 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Karen Xie @ 2014-12-10 21:11 UTC (permalink / raw)
To: linux-scsi, netdev
Cc: kxie, hariprasad, anish, hch, James.Bottomley, michaelc, davem
From: Karen Xie <kxie@chelsio.com>
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>
---
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 22 +++++++++++++++-------
drivers/scsi/cxgbi/libcxgbi.h | 4 ++--
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 1508125..f119a67 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -171,10 +171,14 @@ static int push_tx_frames(struct cxgbi_sock *, int);
* 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.
*/
-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 -
- sizeof(struct fw_ofld_tx_data_wr));
+ int len = skb->len;
+
+ 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,
@@ -597,11 +601,15 @@ static int push_tx_frames(struct cxgbi_sock *csk, int req_completion)
skb_reset_transport_header(skb);
if (is_ofld_imm(skb))
- credits_needed = DIV_ROUND_UP(dlen +
- sizeof(struct fw_ofld_tx_data_wr), 16);
+ credits_needed = DIV_ROUND_UP(dlen, 16);
else
- credits_needed = DIV_ROUND_UP(8*calc_tx_flits_ofld(skb)
- + sizeof(struct fw_ofld_tx_data_wr),
+ credits_needed = DIV_ROUND_UP(
+ 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);
if (csk->wr_cred < credits_needed) {
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 2c7cb1c..aba1af7 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,
__clear_bit(flag, &(cxgbi_skcb_flags(skb)));
}
-static inline int cxgbi_skcb_test_flag(struct sk_buff *skb,
- enum cxgbi_skcb_flags flag)
+static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
+ enum cxgbi_skcb_flags flag)
{
return test_bit(flag, &(cxgbi_skcb_flags(skb)));
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v8 1/7] cxgb4i: fix tx immediate data credit check
2014-12-10 21:11 [PATCH net v8 1/7] cxgb4i: fix tx immediate data credit check Karen Xie
@ 2014-12-11 3:54 ` David Miller
2014-12-11 15:26 ` Karen Xie
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-12-11 3:54 UTC (permalink / raw)
To: kxie
Cc: linux-scsi, netdev, hariprasad, anish, hch, James.Bottomley, michaelc
From: Karen Xie <kxie@chelsio.com>
Date: Wed, 10 Dec 2014 13:11:06 -0800
> From: Karen Xie <kxie@chelsio.com>
>
> 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>
Please text format your commit messages to 80 characters or less per
line.
People are going to read your commits using text tools, not
necessarily GUI tools which will auto-format your commit message.
I know this seems like we are being difficult, but you are making many
fundamental mistakes in your efforts to merge in these changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH net v8 1/7] cxgb4i: fix tx immediate data credit check
2014-12-11 3:54 ` David Miller
@ 2014-12-11 15:26 ` Karen Xie
0 siblings, 0 replies; 3+ messages in thread
From: Karen Xie @ 2014-12-11 15:26 UTC (permalink / raw)
To: David Miller
Cc: linux-scsi, netdev, Hariprasad S, Anish Bhatt, hch,
James.Bottomley, michaelc
From: David Miller [mailto:davem@davemloft.net]
Sent: Wednesday, December 10, 2014 7:55 PM
> Please text format your commit messages to 80 characters or less per line.
>
> People are going to read your commits using text tools, not necessarily GUI
> tools which will auto-format your commit message.
>
> I know this seems like we are being difficult, but you are making many
> fundamental mistakes in your efforts to merge in these changes.
Submitted v9 with reformatted commit messages. Thanks for your patience.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-11 15:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 21:11 [PATCH net v8 1/7] cxgb4i: fix tx immediate data credit check Karen Xie
2014-12-11 3:54 ` David Miller
2014-12-11 15:26 ` Karen Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).