Skip to content

Commit adfb7b4

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: fix the max tx size according to user manual
Currently the max tx size supported by the hw is calculated by using the max BD num supported by the hw. According to the hw user manual, the max tx size is fixed value for both non-TSO and TSO skb. This patch updates the max tx size according to the manual. Fixes: 8ae10cf("net: hns3: support tx-scatter-gather-fraglist feature") Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 731797f commit adfb7b4

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,6 @@ void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size)
18471847

18481848
static int hns3_skb_linearize(struct hns3_enet_ring *ring,
18491849
struct sk_buff *skb,
1850-
u8 max_non_tso_bd_num,
18511850
unsigned int bd_num)
18521851
{
18531852
/* 'bd_num == UINT_MAX' means the skb' fraglist has a
@@ -1864,8 +1863,7 @@ static int hns3_skb_linearize(struct hns3_enet_ring *ring,
18641863
* will not help.
18651864
*/
18661865
if (skb->len > HNS3_MAX_TSO_SIZE ||
1867-
(!skb_is_gso(skb) && skb->len >
1868-
HNS3_MAX_NON_TSO_SIZE(max_non_tso_bd_num))) {
1866+
(!skb_is_gso(skb) && skb->len > HNS3_MAX_NON_TSO_SIZE)) {
18691867
u64_stats_update_begin(&ring->syncp);
18701868
ring->stats.hw_limitation++;
18711869
u64_stats_update_end(&ring->syncp);
@@ -1900,8 +1898,7 @@ static int hns3_nic_maybe_stop_tx(struct hns3_enet_ring *ring,
19001898
goto out;
19011899
}
19021900

1903-
if (hns3_skb_linearize(ring, skb, max_non_tso_bd_num,
1904-
bd_num))
1901+
if (hns3_skb_linearize(ring, skb, bd_num))
19051902
return -ENOMEM;
19061903

19071904
bd_num = hns3_tx_bd_count(skb->len);

drivers/net/ethernet/hisilicon/hns3/hns3_enet.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,9 @@ enum hns3_nic_state {
186186

187187
#define HNS3_MAX_BD_SIZE 65535
188188
#define HNS3_MAX_TSO_BD_NUM 63U
189-
#define HNS3_MAX_TSO_SIZE \
190-
(HNS3_MAX_BD_SIZE * HNS3_MAX_TSO_BD_NUM)
189+
#define HNS3_MAX_TSO_SIZE 1048576U
190+
#define HNS3_MAX_NON_TSO_SIZE 9728U
191191

192-
#define HNS3_MAX_NON_TSO_SIZE(max_non_tso_bd_num) \
193-
(HNS3_MAX_BD_SIZE * (max_non_tso_bd_num))
194192

195193
#define HNS3_VECTOR_GL0_OFFSET 0x100
196194
#define HNS3_VECTOR_GL1_OFFSET 0x200

0 commit comments

Comments
 (0)