linux/drivers/target/iscsi/cxgbit
Varun Prakash d96adb9b07 cxgbit: fix sg_nents calculation
The current logic of calculating sg_nents can fail
if data_offset % PAGE_SIZE is not zero.

For example -
PAGE_SIZE = 4096
data_len = 3072
data_offset = 3072

As per current logic
sg_nents = max(1UL, DIV_ROUND_UP(data_len, PAGE_SIZE));
sg_nents = max(1UL, DIV_ROUND_UP(3072, 4096));
sg_nents = 1

But as data_offset % PAGE_SIZE = 3072 we should skip 3072 bytes
skip = 3K
sg_nents = max(1UL, DIV_ROUND_UP(3K(skip) + 3K(data_len), 4K(PAGE_SIZE));
sg_nents = 2;

This patch fixes this issue by adding skip to data_len.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2017-07-30 15:35:34 -07:00
..
Kconfig libcxgb: add library module for Chelsio drivers 2016-07-25 10:31:08 -07:00
Makefile libcxgb: add library module for Chelsio drivers 2016-07-25 10:31:08 -07:00
cxgbit.h libcxgb: add library module for Chelsio drivers 2016-07-25 10:31:08 -07:00
cxgbit_cm.c cxgbit: add missing __kfree_skb() 2017-07-30 15:26:00 -07:00
cxgbit_ddp.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
cxgbit_lro.h target/cxgbit: add T6 iSCSI DDP completion feature 2017-02-18 21:24:21 -08:00
cxgbit_main.c target/cxgbit: add T6 iSCSI DDP completion feature 2017-02-18 21:24:21 -08:00
cxgbit_target.c cxgbit: fix sg_nents calculation 2017-07-30 15:35:34 -07:00