diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2023-02-23 19:20:17 +0900 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2023-03-10 15:35:38 +0800 |
commit | 69ff5ef8474575556997dbe7f7f9bd28c4aee5de (patch) | |
tree | cd4749e26ddd2b791574e4e3d2a21e8d2d50b570 /hw/net/vmxnet3.c | |
parent | 47399506dcda52b03b6991c57ca2a426ba8e291f (diff) |
net/eth: Report if headers are actually present
The values returned by eth_get_protocols() are used to perform RSS,
checksumming and segmentation. Even when a packet signals the use of the
protocols which these operations can be applied to, the headers for them
may not be present because of too short packet or fragmentation, for
example. In such a case, the operations cannot be applied safely.
Report the presence of headers instead of whether the use of the
protocols are indicated with eth_get_protocols(). This also makes
corresponding changes to the callers of eth_get_protocols() to match
with its new signature and to remove redundant checks for fragmentation.
Fixes: 75020a7021 ("Common definitions for VMWARE devices")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/vmxnet3.c')
-rw-r--r-- | hw/net/vmxnet3.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 6c6bb2ac37..4d65327732 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -847,7 +847,7 @@ static void vmxnet3_rx_need_csum_calculate(struct NetRxPkt *pkt, size_t pkt_len) { struct virtio_net_hdr *vhdr; - bool isip4, isip6, istcp, isudp; + bool hasip4, hasip6, hastcp, hasudp; uint8_t *data; int len; @@ -856,8 +856,8 @@ static void vmxnet3_rx_need_csum_calculate(struct NetRxPkt *pkt, return; } - net_rx_pkt_get_protocols(pkt, &isip4, &isip6, &isudp, &istcp); - if (!(isip4 || isip6) || !(istcp || isudp)) { + net_rx_pkt_get_protocols(pkt, &hasip4, &hasip6, &hasudp, &hastcp); + if (!(hasip4 || hasip6) || !(hastcp || hasudp)) { return; } @@ -885,7 +885,7 @@ static void vmxnet3_rx_update_descr(struct NetRxPkt *pkt, struct Vmxnet3_RxCompDesc *rxcd) { int csum_ok, is_gso; - bool isip4, isip6, istcp, isudp; + bool hasip4, hasip6, hastcp, hasudp; struct virtio_net_hdr *vhdr; uint8_t offload_type; @@ -911,16 +911,16 @@ static void vmxnet3_rx_update_descr(struct NetRxPkt *pkt, goto nocsum; } - net_rx_pkt_get_protocols(pkt, &isip4, &isip6, &isudp, &istcp); - if ((!istcp && !isudp) || (!isip4 && !isip6)) { + net_rx_pkt_get_protocols(pkt, &hasip4, &hasip6, &hasudp, &hastcp); + if ((!hastcp && !hasudp) || (!hasip4 && !hasip6)) { goto nocsum; } rxcd->cnc = 0; - rxcd->v4 = isip4 ? 1 : 0; - rxcd->v6 = isip6 ? 1 : 0; - rxcd->tcp = istcp ? 1 : 0; - rxcd->udp = isudp ? 1 : 0; + rxcd->v4 = hasip4 ? 1 : 0; + rxcd->v6 = hasip6 ? 1 : 0; + rxcd->tcp = hastcp ? 1 : 0; + rxcd->udp = hasudp ? 1 : 0; rxcd->fcs = rxcd->tuc = rxcd->ipc = 1; return; |