diff options
author | Karen Xie <kxie@chelsio.com> | 2009-02-14 00:38:54 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-02-21 21:29:37 -0500 |
commit | f62d0896e67195d4407ef81c6f77a92f72a63e88 (patch) | |
tree | 3b305f041b9ae2c569bce4ac410e8e655b72d7fd /drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |
parent | 949847d195d2bb86f61c289a57edb9207c4a3bbf (diff) |
[SCSI] cxgb3i: Outgoing pdus need to observe skb's MAX_SKB_FRAGS
Need to make sure the outgoing pdu can fit into a single skb. When
calulating the max. outgoing pdu payload size, take into consideration
of
- data can be held in the skb's fragment list, assume 512 bytes per
fragment, and
- data can be held in the headroom.
Signed-off-by: Karen Xie <kxie@chelsio.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/cxgb3i/cxgb3i_iscsi.c')
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c index f0434b74554c..fa2a44f37b36 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c +++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |||
@@ -403,17 +403,15 @@ static inline int cxgb3i_conn_max_xmit_dlength(struct iscsi_conn *conn) | |||
403 | { | 403 | { |
404 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | 404 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
405 | struct cxgb3i_conn *cconn = tcp_conn->dd_data; | 405 | struct cxgb3i_conn *cconn = tcp_conn->dd_data; |
406 | unsigned int max = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, | 406 | unsigned int max = max(512 * MAX_SKB_FRAGS, SKB_TX_HEADROOM); |
407 | cconn->hba->snic->tx_max_size - | ||
408 | ISCSI_PDU_NONPAYLOAD_MAX); | ||
409 | 407 | ||
408 | max = min(cconn->hba->snic->tx_max_size, max); | ||
410 | if (conn->max_xmit_dlength) | 409 | if (conn->max_xmit_dlength) |
411 | conn->max_xmit_dlength = min_t(unsigned int, | 410 | conn->max_xmit_dlength = min(conn->max_xmit_dlength, max); |
412 | conn->max_xmit_dlength, max); | ||
413 | else | 411 | else |
414 | conn->max_xmit_dlength = max; | 412 | conn->max_xmit_dlength = max; |
415 | align_pdu_size(conn->max_xmit_dlength); | 413 | align_pdu_size(conn->max_xmit_dlength); |
416 | cxgb3i_log_info("conn 0x%p, max xmit %u.\n", | 414 | cxgb3i_api_debug("conn 0x%p, max xmit %u.\n", |
417 | conn, conn->max_xmit_dlength); | 415 | conn, conn->max_xmit_dlength); |
418 | return 0; | 416 | return 0; |
419 | } | 417 | } |
@@ -428,9 +426,7 @@ static inline int cxgb3i_conn_max_recv_dlength(struct iscsi_conn *conn) | |||
428 | { | 426 | { |
429 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | 427 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
430 | struct cxgb3i_conn *cconn = tcp_conn->dd_data; | 428 | struct cxgb3i_conn *cconn = tcp_conn->dd_data; |
431 | unsigned int max = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD, | 429 | unsigned int max = cconn->hba->snic->rx_max_size; |
432 | cconn->hba->snic->rx_max_size - | ||
433 | ISCSI_PDU_NONPAYLOAD_MAX); | ||
434 | 430 | ||
435 | align_pdu_size(max); | 431 | align_pdu_size(max); |
436 | if (conn->max_recv_dlength) { | 432 | if (conn->max_recv_dlength) { |
@@ -440,8 +436,7 @@ static inline int cxgb3i_conn_max_recv_dlength(struct iscsi_conn *conn) | |||
440 | conn->max_recv_dlength, max); | 436 | conn->max_recv_dlength, max); |
441 | return -EINVAL; | 437 | return -EINVAL; |
442 | } | 438 | } |
443 | conn->max_recv_dlength = min_t(unsigned int, | 439 | conn->max_recv_dlength = min(conn->max_recv_dlength, max); |
444 | conn->max_recv_dlength, max); | ||
445 | align_pdu_size(conn->max_recv_dlength); | 440 | align_pdu_size(conn->max_recv_dlength); |
446 | } else | 441 | } else |
447 | conn->max_recv_dlength = max; | 442 | conn->max_recv_dlength = max; |