kni: fix compile error
PATCH 1/1 kni: fix compile error
When kernel version change into 5.18 from 5.17, 'netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.
This patch fixed it.
--- kernel/linux/kni/kni_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/linux/kni/kni_net.c +2 -2
@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Call netif interface */ -netif_rx_ni (skb); +netif_rx (skb);/* Update statistics */ dev->stats.rx_bytes += len;
@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p)return -EADDRNOTAVAIL ;memcpy (req.mac_addr, addr->sa_data, netdev->addr_len); -memcpy (netdev->dev_addr, addr->sa_data, netdev->addr_len); +memcpy ((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len); ret =kni_net_process_request (netdev, &req);
Signature · 1 line
2.33.0
Quoted 21 lines · Min Hu (Connor)
[CAUTION: External Email]
When kernel version change into 5.18 from 5.17, '
netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.This patch fixed it.
Fixes d89a58dfe90b ("kni: support chained mbufs")Signed-off-by Min Hu (Connor) <[email protected]>--- kernel/linux/kni/kni_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/linux/kni/kni_net.c +0
-0
kernel/linux/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 445
Quoted 6 lines
kernel/linux/kni/kni_net.c +1
-1@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Call netif interface */ -netif_rx_ni (skb); +netif_rx (skb);
Hi Connor,
There is already a patch for this [1], can you test & ack that instead please?
Same for Mingli's patch [2], @Mingli, can you please test and ack the [1] instead?
[1] kni: update kernel API to receive packets
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
http://inbox.dpdk.org/dev/[email protected]/
[2]
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 782
Quoted 8 lines
kernel/linux/kni/kni_net.c +1
-1/* Update statistics */ dev->stats.rx_bytes += len;@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p)return -EADDRNOTAVAIL ;memcpy (req.mac_addr, addr->sa_data, netdev->addr_len); -memcpy (netdev->dev_addr, addr->sa_data, netdev->addr_len); +memcpy ((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len);
Why don't you use new helper functions instead? I can see not using helper function is causing other problem as well [3].
[3]
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 6 lines
kernel/linux/kni/kni_net.c +0
-1ret =kni_net_process_request (netdev, &req); --2.33.0
Quoted 19 lines · Min Hu (Connor)
When kernel version change into 5.18 from 5.17, '
netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.This patch fixed it.
Fixes d89a58dfe90b ("kni: support chained mbufs")Signed-off-by Min Hu (Connor) <[email protected]>--- kernel/linux/kni/kni_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/linux/kni/kni_net.c +0
-0
kernel/linux/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 444
Quoted 5 lines
kernel/linux/kni/kni_net.c +1
-1@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Call netif interface */ -netif_rx_ni (skb); +netif_rx (skb);
I think the approach in [1] is the right one. Any comments?
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 782
Quoted 9 lines
kernel/linux/kni/kni_net.c +1
-1/* Update statistics */ dev->stats.rx_bytes += len;@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p)return -EADDRNOTAVAIL ;memcpy (req.mac_addr, addr->sa_data, netdev->addr_len); -memcpy (netdev->dev_addr, addr->sa_data, netdev->addr_len); +memcpy ((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len);
I don't understand why the change is needed and the patch description does not shed any light on it.
Quoted 3 lines
kernel/linux/kni/kni_net.c +0
-0ret =kni_net_process_request (netdev, &req);
Hi, Andrew ,
Quoted 30 lines · Andrew Rybchenko
Quoted 19 lines · Min Hu (Connor)
When kernel version change into 5.18 from 5.17, '
netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.This patch fixed it.
Fixes d89a58dfe90b ("kni: support chained mbufs")Signed-off-by Min Hu (Connor) <[email protected]>---
kernel/linux/kni/kni_net.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)kernel/linux/kni/kni_net.c +0
-0kernel/linux/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 443
Quoted 4 lines
kernel/linux/kni/kni_net.c +1
-1@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed = CHECKSUM_UNNECESSARY; /* Call netif interface */ - netif_rx_ni(skb); + netif_rx(skb);I think the approach in [1] is the right one. Any comments?
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 7 lines
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 781
Quoted 7 lines
kernel/linux/kni/kni_net.c +1
-1/* Update statistics */ dev->stats.rx_bytes += len;@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p) return -EADDRNOTAVAIL; memcpy(req.mac_addr, addr->sa_data, netdev->addr_len); - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); + memcpy((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len);
When compile, it will report a warning, because it claims that the parameter types must be the same.
void *memcpy(void *destin, void *source, unsigned n);
so this is what I am doing.
Quoted 7 lines
I don't understand why the change is needed and the patch description does not shed any light on it.
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 784
Quoted 1 line
kernel/linux/kni/kni_net.c +0
-0ret = kni_net_process_request(netdev, &req);.
Quoted 45 lines · Min Hu (Connor)
Hi, Andrew ,
Quoted 30 lines · Andrew Rybchenko
Quoted 19 lines · Min Hu (Connor)
When kernel version change into 5.18 from 5.17, '
netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.This patch fixed it.
Fixes d89a58dfe90b ("kni: support chained mbufs")Signed-off-by Min Hu (Connor) <[email protected]>---
kernel/linux/kni/kni_net.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)kernel/linux/kni/kni_net.c +0
-0kernel/linux/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 443
Quoted 4 lines
kernel/linux/kni/kni_net.c +1
-1@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed = CHECKSUM_UNNECESSARY; /* Call netif interface */ - netif_rx_ni(skb); + netif_rx(skb);I think the approach in [1] is the right one. Any comments?
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 8 lines
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 782
Quoted 8 lines
kernel/linux/kni/kni_net.c +1
-1/* Update statistics */ dev->stats.rx_bytes += len;@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p) return -EADDRNOTAVAIL; memcpy(req.mac_addr, addr->sa_data, netdev->addr_len); - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); + memcpy((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len);When compile, it will report a warning, because it claims that the parameter types must be the same.
void *memcpy(void *destin, void *source, unsigned n);
Quoted 1 line
so this is what I am doing.
I think it is a separate story vs netif_rx_ni(). So, it should not be in the same patch. IMHO, it is closer to [1]
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Am I missing something?
Quoted 7 lines
Quoted 7 lines
I don't understand why the change is needed and the patch description does not shed any light on it.
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 784
Quoted 1 line
kernel/linux/kni/kni_net.c +0
-0ret = kni_net_process_request(netdev, &req);.
Quoted 48 lines · Andrew Rybchenko
Quoted 45 lines · Min Hu (Connor)
Hi, Andrew ,
Quoted 30 lines · Andrew Rybchenko
Quoted 19 lines · Min Hu (Connor)
When kernel version change into 5.18 from 5.17, '
netif_rx_ni' is discard. It is replaced by 'netif_rx' and this API is also supported in the version below 5.18.This patch fixed it.
Fixes d89a58dfe90b ("kni: support chained mbufs")Signed-off-by Min Hu (Connor) <[email protected]>---
kernel/linux/kni/kni_net.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)kernel/linux/kni/kni_net.c +0
-0kernel/linux/kni/kni_net.c kni_net_rx_normal(struct kni_dev *kni) · line 443
Quoted 4 lines
kernel/linux/kni/kni_net.c +1
-1@@ -441,7 +441,7 @@ kni_net_rx_normal(struct kni_dev *kni) skb->ip_summed = CHECKSUM_UNNECESSARY; /* Call netif interface */ - netif_rx_ni(skb); + netif_rx(skb);I think the approach in [1] is the right one. Any comments?
[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 8 lines
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 782
Quoted 8 lines
kernel/linux/kni/kni_net.c +1
-1/* Update statistics */ dev->stats.rx_bytes += len;@@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p) return -EADDRNOTAVAIL; memcpy(req.mac_addr, addr->sa_data, netdev->addr_len); - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); + memcpy((void *)(netdev->dev_addr), addr->sa_data, netdev->addr_len);When compile, it will report a warning, because it claims that the parameter types must be the same.
void *memcpy(void *destin, void *source, unsigned n);Quoted 1 line
so this is what I am doing.
Quoted 8 lines
I think it is a separate story vs
netif_rx_ni(). So, it should not be in the same patch. IMHO, it is closer to [1][1] https://patches.dpdk.org/project/dpdk/patch/[email protected]/
Am I missing something?
There are two build errors because of kernel side changes.
- netif_rx_ni(). Following patch seems correct fix with small change requests:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
- 'net_dev->dev_addr' being const, following patch is in correct direction:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
I don't understand why the change is needed and the patch description does not shed any light on it.
kernel/linux/kni/kni_net.c kni_net_set_mac(struct net_device *netdev, void *p) · line 784
Quoted 1 line
kernel/linux/kni/kni_net.c +0
-0ret = kni_net_process_request(netdev, &req);.