diff options
author | Fuyun Liang <liangfuyun1@huawei.com> | 2018-01-12 03:23:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-12 10:12:32 -0500 |
commit | 8b1ff1ea2ccb09907d1af268e6450c061f477112 (patch) | |
tree | 6e839dd84a4d0ed9fb006334c34c9ae810615aeb | |
parent | 5fd4789a98f8661a0e8db3daf21b774213c99487 (diff) |
net: hns3: refactor GL update function
The GL update function uses the max GL value between tx_int_gl and
rx_int_gl to set both new tx_int_gl and new rx_int_gl. Therefore, User
can not enable TX GL self-adaptive or RX GL self-adaptive individually.
This patch refactors the code to update the TX GL and the RX GL
separately, making user can enable TX GL self-adaptive or RX GL
self-adaptive individually.
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 59d8d9fa8da7..2a139ef5ae30 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | |||
@@ -2459,25 +2459,22 @@ static bool hns3_get_new_int_gl(struct hns3_enet_ring_group *ring_group) | |||
2459 | 2459 | ||
2460 | static void hns3_update_new_int_gl(struct hns3_enet_tqp_vector *tqp_vector) | 2460 | static void hns3_update_new_int_gl(struct hns3_enet_tqp_vector *tqp_vector) |
2461 | { | 2461 | { |
2462 | u16 rx_int_gl, tx_int_gl; | 2462 | struct hns3_enet_ring_group *rx_group = &tqp_vector->rx_group; |
2463 | bool rx, tx; | 2463 | struct hns3_enet_ring_group *tx_group = &tqp_vector->tx_group; |
2464 | 2464 | bool rx_update, tx_update; | |
2465 | rx = hns3_get_new_int_gl(&tqp_vector->rx_group); | 2465 | |
2466 | tx = hns3_get_new_int_gl(&tqp_vector->tx_group); | 2466 | if (rx_group->gl_adapt_enable) { |
2467 | rx_int_gl = tqp_vector->rx_group.int_gl; | 2467 | rx_update = hns3_get_new_int_gl(rx_group); |
2468 | tx_int_gl = tqp_vector->tx_group.int_gl; | 2468 | if (rx_update) |
2469 | if (rx && tx) { | 2469 | hns3_set_vector_coalesce_rx_gl(tqp_vector, |
2470 | if (rx_int_gl > tx_int_gl) { | 2470 | rx_group->int_gl); |
2471 | tqp_vector->tx_group.int_gl = rx_int_gl; | 2471 | } |
2472 | tqp_vector->tx_group.flow_level = | 2472 | |
2473 | tqp_vector->rx_group.flow_level; | 2473 | if (tx_group->gl_adapt_enable) { |
2474 | hns3_set_vector_coalesc_gl(tqp_vector, rx_int_gl); | 2474 | tx_update = hns3_get_new_int_gl(&tqp_vector->tx_group); |
2475 | } else { | 2475 | if (tx_update) |
2476 | tqp_vector->rx_group.int_gl = tx_int_gl; | 2476 | hns3_set_vector_coalesce_tx_gl(tqp_vector, |
2477 | tqp_vector->rx_group.flow_level = | 2477 | tx_group->int_gl); |
2478 | tqp_vector->tx_group.flow_level; | ||
2479 | hns3_set_vector_coalesc_gl(tqp_vector, tx_int_gl); | ||
2480 | } | ||
2481 | } | 2478 | } |
2482 | } | 2479 | } |
2483 | 2480 | ||