Skip to content

Commit 2de0968

Browse files
tlfalcondavem330
authored andcommitted
ibmvnic: Fix calculation of number of TX header descriptors
This patch correctly sets the number of additional header descriptors that will be sent in an indirect SCRQ entry. Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d965465 commit 2de0968

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,11 +1093,12 @@ static int build_hdr_data(u8 hdr_field, struct sk_buff *skb,
10931093
* places them in a descriptor array, scrq_arr
10941094
*/
10951095

1096-
static void create_hdr_descs(u8 hdr_field, u8 *hdr_data, int len, int *hdr_len,
1097-
union sub_crq *scrq_arr)
1096+
static int create_hdr_descs(u8 hdr_field, u8 *hdr_data, int len, int *hdr_len,
1097+
union sub_crq *scrq_arr)
10981098
{
10991099
union sub_crq hdr_desc;
11001100
int tmp_len = len;
1101+
int num_descs = 0;
11011102
u8 *data, *cur;
11021103
int tmp;
11031104

@@ -1126,7 +1127,10 @@ static void create_hdr_descs(u8 hdr_field, u8 *hdr_data, int len, int *hdr_len,
11261127
tmp_len -= tmp;
11271128
*scrq_arr = hdr_desc;
11281129
scrq_arr++;
1130+
num_descs++;
11291131
}
1132+
1133+
return num_descs;
11301134
}
11311135

11321136
/**
@@ -1144,16 +1148,12 @@ static void build_hdr_descs_arr(struct ibmvnic_tx_buff *txbuff,
11441148
int *num_entries, u8 hdr_field)
11451149
{
11461150
int hdr_len[3] = {0, 0, 0};
1147-
int tot_len, len;
1151+
int tot_len;
11481152
u8 *hdr_data = txbuff->hdr_data;
11491153

11501154
tot_len = build_hdr_data(hdr_field, txbuff->skb, hdr_len,
11511155
txbuff->hdr_data);
1152-
len = tot_len;
1153-
len -= 24;
1154-
if (len > 0)
1155-
num_entries += len % 29 ? len / 29 + 1 : len / 29;
1156-
create_hdr_descs(hdr_field, hdr_data, tot_len, hdr_len,
1156+
*num_entries += create_hdr_descs(hdr_field, hdr_data, tot_len, hdr_len,
11571157
txbuff->indir_arr + 1);
11581158
}
11591159

0 commit comments

Comments
 (0)