1 From ba748ab91a62db57f9bdf69dd306e6557315db85 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Mon, 3 Oct 2022 23:05:14 +0200
4 Subject: [PATCH] nss-dp: adapt to netif_napi_add() changes
6 netif_napi_add() removed the weight argument and just uses the default
7 NAPI_POLL_WEIGHT in background, so for those requiring custom weight use
8 netif_napi_add_weight() instead.
10 Signed-off-by: Robert Marko <robimarko@gmail.com>
12 hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 6 +++++-
13 hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c | 8 +++++++-
14 hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c | 7 ++++++-
15 hal/dp_ops/syn_gmac_dp/syn_dp.c | 5 +++++
16 4 files changed, 23 insertions(+), 3 deletions(-)
18 --- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
19 +++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
20 @@ -838,8 +838,12 @@ static int edma_register_netdevice(struc
23 if (!edma_hw.napi_added) {
24 +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
25 netif_napi_add(netdev, &edma_hw.napi, edma_napi,
29 + netif_napi_add(netdev, &edma_hw.napi, edma_napi);
32 * Register the interrupt handlers and enable interrupts
34 --- a/hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c
35 +++ b/hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c
36 @@ -1097,8 +1097,14 @@ void edma_cfg_rx_napi_add(struct edma_gb
38 for (i = 0; i < egc->num_rxdesc_rings; i++) {
39 struct edma_rxdesc_ring *rxdesc_ring = &egc->rxdesc_rings[i];
40 +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
41 netif_napi_add(netdev, &rxdesc_ring->napi,
42 - edma_rx_napi_poll, nss_dp_rx_napi_budget);
43 + edma_rx_napi_poll, nss_dp_rx_napi_budget);
46 + netif_napi_add_weight(netdev, &rxdesc_ring->napi,
47 + edma_rx_napi_poll, nss_dp_rx_napi_budget);
49 rxdesc_ring->napi_added = true;
51 edma_info("%s: Rx NAPI budget: %d\n", netdev->name, nss_dp_rx_napi_budget);
52 --- a/hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c
53 +++ b/hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c
54 @@ -672,8 +672,13 @@ void edma_cfg_tx_napi_add(struct edma_gb
55 for (i = 0; i < egc->num_txcmpl_rings; i++) {
56 struct edma_txcmpl_ring *txcmpl_ring = &egc->txcmpl_rings[i];
58 +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
59 netif_napi_add(netdev, &txcmpl_ring->napi,
60 - edma_tx_napi_poll, nss_dp_tx_napi_budget);
61 + edma_tx_napi_poll, nss_dp_tx_napi_budget);
63 + netif_napi_add_weight(netdev, &txcmpl_ring->napi,
64 + edma_tx_napi_poll, nss_dp_tx_napi_budget);
66 txcmpl_ring->napi_added = true;
68 edma_info("Tx NAPI budget: %d\n", nss_dp_tx_napi_budget);
69 --- a/hal/dp_ops/syn_gmac_dp/syn_dp.c
70 +++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c
71 @@ -189,8 +189,13 @@ static int syn_dp_if_init(struct nss_dp_
74 if (!dev_info->napi_added) {
75 +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
76 netif_napi_add(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX);
77 netif_napi_add(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX);
79 + netif_napi_add_weight(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX);
80 + netif_napi_add_weight(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX);
84 * Requesting irq. Set IRQ_DISABLE_UNLAZY flag, this flag