net: increase LL_MAX_HEADER for Hyper-V
Subsystems (2)
RFC PATCH 1/1 net: increase LL_MAX_HEADER for Hyper-V
Commit b08cc79155fc26d0d112b1470d1ece5034651a4b ("hv_netvsc: Eliminate
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom = sizeof(struct hv_netvsc_packet) +
sizeof(struct rndis_message) + NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE + NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE;
...
net->needed_headroom = max_needed_headroom;
max_needed_headroom is 220 bytes, it significantly exceeds the LL_MAX_HEADER setting. This causes each skb to be cloned on send path, e.g. for IPv4 case we fall into the following clause (ip_finish_output2()):
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
...
skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
...
}leading to a significant performance regression. Increase LL_MAX_HEADER to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb headroom request restoring manual memory allocation on transmit path.
--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/netdevice.h +3 -1
@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else
Signature · 1 line
2.4.3
Quoted 49 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VCommit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc: Eliminate
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on send path, e.g. for IPv4 case we fall into the following clause (ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERto make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0
include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else
Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro in netdevice.h such as:
#define HVNETVSC_MAX_HEADER 224
#define LL_MAX_HEADER HVNETVSC_MAX_HEADER
And, put a note in netvsc code saying the header reservation shouldn't exceed HVNETVSC_MAX_HEADER, or you need to update HVNETVSC_MAX_HEADER.
Thanks,
- Haiyang
From: Haiyang Zhang
Quoted 66 lines
Sent: 16 September 2015 17:09
Quoted 47 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VCommit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc: Eliminate
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on send path, e.g. for IPv4 case we fall into the following clause (ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERto make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADER
Quoted 2 lines
And, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to updateHVNETVSC_MAX_HEADER.
Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
David
Quoted 66 lines · David Laight
From: Haiyang Zhang
Quoted 65 lines
Sent: 16 September 2015 17:09
Quoted 47 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VCommit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc: Eliminate
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on send path, e.g. for IPv4 case we fall into the following clause (ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERto make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADER
Quoted 7 lines
Quoted 2 lines
And, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to updateHVNETVSC_MAX_HEADER.Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Actually it will probably add closer to 128 unused bytes per frame since an skb allocation is rounded off to the nearest cache line in terms of size.
Is there a reason why this buffer info and descriptor like thing even needs to be in the packet header? From what I can tell it was being allocated separately before. Why not just maintain a ring of them if you need to keep them around and want to avoid having to reallocate them for the next transmit? Also I don't know if the layout matters but it probably wouldn't hurt to go through with pahole and clean the hv_netvsc_packet structure up. You could probably save yourself something like 20+ bytes just doing that.
- Alex
Quoted 86 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 9:25 AM
To: Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Jason Wang <[email protected]>
Subject: RE: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper- VFrom: Haiyang Zhang
Quoted 6 lines
Sent: 16 September 2015 17:09
Quoted 5 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 3 lines
Quoted 3 lines
KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 2 lines
Quoted 2 lines
Commit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc:Eliminate
Quoted 10 lines
Quoted 10 lines
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;Quoted 2 lines
Quoted 2 lines
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on sendpath,
Quoted 10 lines
Quoted 10 lines
e.g. for IPv4 case we fall into the following clause (
ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERQuoted 33 lines
Quoted 15 lines
to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADERQuoted 2 lines
And, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to update
Quoted 7 lines
HVNETVSC_MAX_HEADER.Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Remote NDIS is the protocol used to send packets from the guest to the host. Every packet needs to be decorated with the RNDIS header and the maximum room needed for the RNDIS header is the hreadroom we want.
K. Y
Quoted 2 lines
David
Quoted 85 lines · KY Srinivasan
Quoted 85 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 9:25 AM
To: Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Jason Wang <[email protected]>
Subject: RE: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper- VFrom: Haiyang Zhang
Quoted 6 lines
Sent: 16 September 2015 17:09
Quoted 5 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 3 lines
Quoted 3 lines
KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 1 line
Quoted 1 line
Commit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc:Eliminate
Quoted 10 lines
Quoted 10 lines
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;Quoted 2 lines
Quoted 2 lines
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on sendpath,
Quoted 10 lines
Quoted 10 lines
e.g. for IPv4 case we fall into the following clause (
ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERQuoted 32 lines
Quoted 15 lines
to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADERQuoted 2 lines
And, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to update
HVNETVSC_MAX_HEADER.
Quoted 8 lines
Quoted 5 lines
Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Remote NDIS is the protocol used to send packets from the guest to the host. Every packet needs to be decorated with the RNDIS header and the maximum room needed for the RNDIS header is the hreadroom we want.
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
So for example in netvsc_start_xmit it looks like you are calling init_page_array in order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.
- Alex
Quoted 113 lines
-----Original Message-----
From: Alexander Duyck [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 2:39 PM
To: KY Srinivasan <[email protected]>; David Laight <[email protected]>; Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; Jason Wang <[email protected]>
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VQuoted 83 lines · KY Srinivasan
Quoted 83 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 9:25 AM
To: Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Jason Wang <[email protected]>
Subject: RE: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper- VFrom: Haiyang Zhang
Quoted 6 lines
Sent: 16 September 2015 17:09
Quoted 5 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 3 lines
Quoted 3 lines
KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 1 line
Quoted 1 line
Commit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc:Eliminate
Quoted 10 lines
Quoted 10 lines
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;Quoted 2 lines
Quoted 2 lines
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on sendpath,
Quoted 10 lines
Quoted 10 lines
e.g. for IPv4 case we fall into the following clause (
ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERQuoted 34 lines
Quoted 15 lines
to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADERAnd, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to updateQuoted 8 lines
Quoted 7 lines
HVNETVSC_MAX_HEADER.Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Remote NDIS is the protocol used to send packets from the guest to the host.
Every packet
Quoted 1 line
needs to be decorated with the RNDIS header and the maximum room needed
for the RNDIS
Quoted 1 line
header is the hreadroom we want.
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
Quoted 7 lines
So for example in
netvsc_start_xmitit looks like you are callinginit_page_arrayin order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.
You are right; the rndis header can be built as a separate fragment and sent. Indeed this is what we were doing earlier - on the outgoing path we would allocate memory for the rndis header. My goal was to avoid this allocation on every packet being sent and I decided to use the headroom instead. If we can completely avoid all memory allocation for rndis header, it makes a significant perf difference:
Throughput as measured by iperf on a 40G interface (VM to VM on two nodes) in Gbps. Scenario #A: LL_MAX_HEADER =128 [no change], needed_headroom = 220 [no change] Scenario #B: LL_MAX_HEADER =224, needed_headroom = 220 [no change]
Conn# #A #B
1 6.9 8.2 2 13.2 14.9 4 17.6 16.6 8 24.1 26.9 16 24.0 31.5 32 24.5 33.6 64 31.6 31.5
128 29.6 30.3
Column A is the existing code where we end up having to allocate more headroom and column B is with Vitaly's patch. I will experiment with a light-weight allocator for the rndis header.
Regards,
K. Y
Quoted 2 lines
- Alex
Quoted 135 lines · KY Srinivasan
Quoted 110 lines
-----Original Message-----
From: Alexander Duyck [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 2:39 PM
To: KY Srinivasan <[email protected]>; David Laight <[email protected]>; Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; Jason Wang <[email protected]>
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VQuoted 82 lines · KY Srinivasan
Quoted 82 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 9:25 AM
To: Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; KY Srinivasan <[email protected]>; Jason Wang <[email protected]>
Subject: RE: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper- VFrom: Haiyang Zhang
Quoted 6 lines
Sent: 16 September 2015 17:09
Quoted 5 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 3 lines
Quoted 3 lines
KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 1 line
Quoted 1 line
Commit
b08cc79155fc26d0d112b1470d1ece5034651a4b("hv_netvsc:Eliminate
Quoted 10 lines
Quoted 10 lines
memory allocation in the packet send path") introduced skb headroom
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;Quoted 2 lines
Quoted 2 lines
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on sendpath,
Quoted 10 lines
Quoted 10 lines
e.g. for IPv4 case we fall into the following clause (
ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }leading to a significant performance regression. Increase
LL_MAX_HEADERQuoted 34 lines
Quoted 15 lines
to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmit path.Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADERAnd, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to updateQuoted 8 lines
Quoted 7 lines
HVNETVSC_MAX_HEADER.Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Remote NDIS is the protocol used to send packets from the guest to the host.
Every packet
Quoted 1 line
needs to be decorated with the RNDIS header and the maximum room needed
for the RNDIS
Quoted 1 line
header is the hreadroom we want.
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
Quoted 7 lines
So for example in
netvsc_start_xmitit looks like you are callinginit_page_arrayin order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.You are right; the rndis header can be built as a separate fragment and sent. Indeed this is what we were doing earlier - on the outgoing path we would allocate memory for the rndis header. My goal was to avoid this allocation on every packet being sent and I decided to use the headroom instead. If we can completely avoid all memory allocation for rndis header, it makes a significant perf difference:
Throughput as measured by iperf on a 40G interface (VM to VM on two nodes) in Gbps. Scenario #A:
LL_MAX_HEADER=128 [no change],needed_headroom= 220 [no change] Scenario #B:LL_MAX_HEADER=224,needed_headroom= 220 [no change]Conn# #A #B
1 6.9 8.2 2 13.2 14.9 4 17.6 16.6 8 24.1 26.9 16 24.0 31.5 32 24.5 33.6 64 31.6 31.5
Quoted 8 lines
128 29.6 30.3
Column A is the existing code where we end up having to allocate more headroom and column B is with Vitaly's patch. I will experiment with a light-weight allocator for the rndis header.
Regards,
K. Y
I get the performance implications, but that is increasing the memory footprint for every driver in the system that is holding any outstanding transmit buffers. Also it will likely have a negative impact on transmit performance as it increases the truesize of every outgoing buffer.
The other thing I don't get is why hv_netvsc_packet was being included in this allocation as well. It seems like it is just metadata that is used for each outgoing frame. Odds are you could probably make it a separate allocation as well, however if nothing else you should probably look at rearranging the structure to fill the holes as it looks like you have about 16 bytes of wasted space due to the arrangement of 32b and 64b values. Fixing that would allow you to reduce your needed_headroom which may also help to improve things.
- Alex
Quoted 179 lines
-----Original Message-----
From: Alexander Duyck [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 4:49 PM
To: KY Srinivasan <[email protected]>; David Laight <[email protected]>; Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; Jason Wang <[email protected]>
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VQuoted 10 lines · KY Srinivasan
Quoted 10 lines
-----Original Message-----
From: Alexander Duyck [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 2:39 PM
To: KY Srinivasan <[email protected]>; David Laight <[email protected]>; Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; Jason Wang <[email protected]>
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 8 lines
Quoted 8 lines · KY Srinivasan
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 9:25 AM
To: Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
KY Srinivasan <[email protected]>; Jason Wang
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Subject: RE: [PATCH net-next RFC] net: increase
LL_MAX_HEADERforHyper-
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
V
From: Haiyang Zhang
Quoted 6 lines
Sent: 16 September 2015 17:09
Quoted 5 lines
-----Original Message-----
From: Vitaly Kuznetsov [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 11:50 AM
To: [email protected]
Cc: David S. Miller <[email protected]>; linux-Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH net-next RFC] net: increaseLL_MAX_HEADERforHyper-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
V
Quoted 1 line
Quoted 1 line
Commit
b08cc79155fc26d0d112b1470d1ece5034651a4b("
hv_netvsc:Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Eliminate
Quoted 1 line
Quoted 1 line
memory allocation in the packet send path") introduced skb
headroom
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
request for Hyper-V netvsc driver:
max_needed_headroom=sizeof(struct hv_netvsc_packet)+
sizeof(struct rndis_message)+NDIS_VLAN_PPI_SIZE+NDIS_CSUM_PPI_SIZE+NDIS_LSO_PPI_SIZE+NDIS_HASH_PPI_SIZE;
...
net->needed_headroom=max_needed_headroom;
max_needed_headroomis 220 bytes, it significantly exceeds theLL_MAX_HEADERsetting. This causes each skb to be cloned on sendpath,
Quoted 9 lines
Quoted 9 lines
e.g. for IPv4 case we fall into the following clause (
ip_finish_output2()):if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { ... skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); ... }Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
leading to a significant performance regression. Increase
LL_MAX_HEADERQuoted 4 lines
Quoted 4 lines
to make it suitable for netvsc, make it 224 to be 16-aligned. Alternatively we could (partially) revert the commit which introduced skb
headroom request restoring manual memory allocation on transmitpath.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 11 lines
Signed-off-by Vitaly Kuznetsov <[email protected]>--- include/linux/netdevice.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/linux/netdevice.h +0
-0include/linux/netdevice.h static inline bool dev_xmit_complete(int rc) · line 140
Quoted 10 lines
include/linux/netdevice.h +3
-1@@ -132,7 +132,9 @@ static inline bool dev_xmit_complete(int rc)* used. */ -#if defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 ) +#if IS_ENABLED (CONFIG_HYPERV_NET ) +# define LL_MAX_HEADER 224 +#elif defined(CONFIG_WLAN ) ||IS_ENABLED (CONFIG_AX25 )# if defined(CONFIG_MAC80211_MESH )# define LL_MAX_HEADER 128# else Thanks for the patch.
To avoid we forget to update that 224 number when we add more things into netvsc header, I suggest that we define a macro innetdevice.hsuch as:
#defineHVNETVSC_MAX_HEADER224
#defineLL_MAX_HEADERHVNETVSC_MAX_HEADERAnd, put a note in netvsc code saying the header reservation shouldn't exceed
HVNETVSC_MAX_HEADER, or you need to updateQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
HVNETVSC_MAX_HEADER.Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Remote NDIS is the protocol used to send packets from the guest to the
host.
Quoted 2 lines
Quoted 2 lines
Every packet
Quoted 1 line
needs to be decorated with the RNDIS header and the maximum room
needed
Quoted 13 lines
Quoted 6 lines
for the RNDIS
Quoted 1 line
header is the hreadroom we want.
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
Quoted 7 lines
So for example in
netvsc_start_xmitit looks like you are callinginit_page_arrayin order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.Quoted 2 lines
You are right; the rndis header can be built as a separate fragment and sent. Indeed this is what we were doing earlier - on the outgoing path we would
allocate
Quoted 1 line
memory for the rndis header. My goal was to avoid this allocation on every
packet being
Quoted 1 line
sent and I decided to use the headroom instead. If we can completely avoid all
memory
Quoted 3 lines
allocation for rndis header, it makes a significant perf difference:
Throughput as measured by iperf on a 40G interface (VM to VM on two
nodes) in Gbps.
Quoted 1 line
Scenario #A:
LL_MAX_HEADER=128 [no change],needed_headroom= 220[no change]
Quoted 10 lines
Scenario #B:
LL_MAX_HEADER=224,needed_headroom= 220 [no change]Conn# #A #B
1 6.9 8.2 2 13.2 14.9 4 17.6 16.6 8 24.1 26.9 16 24.0 31.5 32 24.5 33.6 64 31.6 31.5Quoted 3 lines
128 29.6 30.3
Column A is the existing code where we end up having to allocate more
headroom and column B is with
Quoted 1 line
Vitaly's patch. I will experiment with a light-weight allocator for the rndis
header.
Quoted 4 lines
Regards,
K. Y
I get the performance implications, but that is increasing the memory footprint for every driver in the system that is holding any outstanding transmit buffers. Also it will likely have a negative impact on transmit performance as it increases the truesize of every outgoing buffer.
Quoted 8 lines
The other thing I don't get is why
hv_netvsc_packetwas being included in this allocation as well. It seems like it is just metadata that is used for each outgoing frame. Odds are you could probably make it a separate allocation as well, however if nothing else you should probably look at rearranging the structure to fill the holes as it looks like you have about 16 bytes of wasted space due to the arrangement of 32b and 64b values. Fixing that would allow you to reduce yourneeded_headroomwhich may also help to improve things.
Agreed; I will address this as well.
K. Y
Quoted 2 lines
- Alex
From: KY Srinivasan
Quoted 1 line
Sent: 16 September 2015 23:58
...
Quoted 12 lines
Quoted 11 lines
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
So for example in
netvsc_start_xmitit looks like you are callinginit_page_arrayin order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.
Quoted 5 lines
You are right; the rndis header can be built as a separate fragment and sent. Indeed this is what we were doing earlier - on the outgoing path we would allocate memory for the rndis header. My goal was to avoid this allocation on every packet being sent and I decided to use the headroom instead. If we can completely avoid all memory allocation for rndis header, it makes a significant perf difference:
...
So just preallocate the header space as a fixed buffer for each ring entry (or tx frame).
If you allocate a fixed buffer for each ring entry you may find there are performance gains from copying small fragments into the buffer instead of doing whatever mapping operations are required.
David
Quoted 38 lines
-----Original Message-----
From: David Laight [mailto:[email protected]]
Sent: Thursday, September 17, 2015 1:38 AM
To: KY Srinivasan <[email protected]>; Alexander Duyck <[email protected]>; Haiyang Zhang <[email protected]>; Vitaly Kuznetsov <[email protected]>; [email protected]
Cc: David S. Miller <[email protected]>; [email protected]; Jason Wang <[email protected]>
Subject: RE: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VFrom: KY Srinivasan
Quoted 1 line
Sent: 16 September 2015 23:58
...
Quoted 12 lines
Quoted 11 lines
I think we get that. The question is does the Remote NDIS header and packet info actually need to be a part of the header data? I would argue that it probably doesn't.
So for example in
netvsc_start_xmitit looks like you are callinginit_page_arrayin order to populate a set of page buffers, but the first buffer for the Remote NDIS protocol is populated as a separate page and offset. As such it doesn't seem like it necessarily needs to be a part of the header data but could be maintained perhaps in a separate ring buffer, or perhaps just be a separate page that you break up to use for each header.Quoted 2 lines
You are right; the rndis header can be built as a separate fragment and sent. Indeed this is what we were doing earlier - on the outgoing path we would
allocate
Quoted 1 line
memory for the rndis header. My goal was to avoid this allocation on every
packet being
Quoted 1 line
sent and I decided to use the headroom instead. If we can completely avoid all
memory
Quoted 1 line
allocation for rndis header, it makes a significant perf difference:
...
Quoted 8 lines
So just preallocate the header space as a fixed buffer for each ring entry (or tx frame).
If you allocate a fixed buffer for each ring entry you may find there are performance gains from copying small fragments into the buffer instead of doing whatever mapping operations are required.
David
Yes; I could do that. My original goal of asking for additional head room was to avoid having any allocation in the transmit path. I did not realize that all I had done was push the allocation to a different spot since the head room I was asking was greater than the default head room on skb allocation.
I think I can achieve my original goal of not having any allocation in the send path by carefully using the memory available in the skb:
1. I am going to separately handle the rndis header and this can be packed in the default headroom available in the skb.
2. I will use the scratch area in the skb to stash away the state that needs to persist. This is the state needed to cleanup the guest state after we get the send_complete packet.
Regards,
K. Y
David Miller
maintainerFrom: KY Srinivasan <[email protected]>
Date: Thu, 17 Sep 2015 15:14:05 +0000
Quoted 2 lines
I think I can achieve my original goal of not having any allocation in the send path by carefully using the memory available in the skb:
Please stop flat-out ignoring David L.'s suggestion.
Have a pre-cooked ring of buffers for these descriptors that you can point the chip at. No per-packet allocation is necessary at all.
If you play games with SKBs you will get burned.
Quoted 11 lines
-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Thursday, September 17, 2015 11:52 AM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; Haiyang Zhang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-V
Quoted 7 lines
From: KY Srinivasan <[email protected]>
Date: Thu, 17 Sep 2015 15:14:05 +0000Quoted 2 lines
I think I can achieve my original goal of not having any allocation in the send path by carefully using the memory available in the skb:
Please stop flat-out ignoring David L.'s suggestion.
I am sorry; I did not mean to convey that impression.
Quoted 3 lines
Have a pre-cooked ring of buffers for these descriptors that you can point the chip at. No per-packet allocation is necessary at all.
Even if I had a ring of buffers, I would still need to manage the life cycle of these buffers - selecting an unused one on the transmit path and marking it used (atomically). Once the transmit completes (as indicated by the transmit complete callback) this buffer needs to be marked free. I can certainly make these operations efficient and lock-free, but they are still at some level an allocation/free operation albeit potentially more efficient than having the kernel allocate the memory.
Quoted 2 lines
If you play games with SKBs you will get burned.
I will implement Dave L's suggestion. However, I am curious as to why you would consider my proposed usage of the skb headroom and the control buffer area in skb as non-standard usage.
Regards,
K. Y
David Miller
maintainerFrom: KY Srinivasan <[email protected]>
Date: Thu, 17 Sep 2015 19:52:01 +0000
Quoted 9 lines
Quoted 5 lines
-----Original Message-----
Have a pre-cooked ring of buffers for these descriptors that you can point the chip at. No per-packet allocation is necessary at all.Even if I had a ring of buffers, I would still need to manage the life cycle of these buffers - selecting an unused one on the transmit path and marking it used (atomically).
Have one per TX ring entry, then the lifetime matches the lifetime of the TX entry itself and therefore you need do nothing.
That's the whole idea.
Quoted 20 lines
-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Thursday, September 17, 2015 1:11 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; Haiyang Zhang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next RFC] net: increaseLL_MAX_HEADERfor Hyper-VFrom: KY Srinivasan <[email protected]>
Date: Thu, 17 Sep 2015 19:52:01 +0000Quoted 6 lines
Quoted 5 lines
-----Original Message-----
Have a pre-cooked ring of buffers for these descriptors that you can point the chip at. No per-packet allocation is necessary at all.
Quoted 6 lines
Quoted 3 lines
Even if I had a ring of buffers, I would still need to manage the life cycle of these buffers - selecting an unused one on the transmit path and marking it used (atomically).
Have one per TX ring entry, then the lifetime matches the lifetime of the TX entry itself and therefore you need do nothing.
Yes, I understand. Unfortunately, the ring buffer used on Hyper-V to send the packets to the host is not managed as a traditional TX ring entries - it is not fixed size and a given packet can wrap around and lastly, I think the management of space on the ring buffer is not tied to the act of completing the send operation. That is why we have an explicit "send complete" message.
I am working on moving the model to more closely match the hardware model but it will take some time. For now, I will implement a very light weight mechanism for managing the additional memory needed.
Regards,
K. Y
Quoted 2 lines
That's the whole idea.
David Miller
maintainerFrom: David Laight <[email protected]>
Date: Wed, 16 Sep 2015 16:25:03 +0000
Quoted 5 lines
Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Agreed, this is rediculous, and the entire stack will incur this cost just because hyperv is enabled in the kernel config.
Quoted 11 lines · David Miller
From: David Laight <[email protected]>
Date: Wed, 16 Sep 2015 16:25:03 +0000Quoted 5 lines
Am I right in thinking this is adding an extra 96 unused bytes to the front of almost all skb just so that hyper-v can make its link level header contiguous with whatever follows (IP header ?).
Doesn't sound ideal.
Agreed, this is rediculous, and the entire stack will incur this cost just because hyperv is enabled in the kernel config.
That's what 'RFC' in the subject was about :-)
We already have a precedent of increasing LL_MAX_HEADER globaly because of a config option (CONFIG_MAC80211_MESH) but Hyper-V needs more.
Signature · 1 line
Vitaly