Skip to content

Commit 3846244

Browse files
philmdjasowang
authored andcommitted
net/eth: Simplify _eth_get_rss_ex_dst_addr()
The length field is already contained in the ip6_ext_hdr structure. Check it direcly in eth_parse_ipv6_hdr() before calling _eth_get_rss_ex_dst_addr(), which gets a bit simplified. Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
1 parent b565b44 commit 3846244

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/eth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
407407
{
408408
struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;
409409

410-
if ((rthdr->rtype == 2) &&
411-
(rthdr->len == sizeof(struct in6_address) / 8) &&
412-
(rthdr->segleft == 1)) {
410+
if ((rthdr->rtype == 2) && (rthdr->segleft == 1)) {
413411

414412
size_t input_size = iov_size(pkt, pkt_frags);
415413
size_t bytes_read;
@@ -528,10 +526,12 @@ bool eth_parse_ipv6_hdr(const struct iovec *pkt, int pkt_frags,
528526
}
529527

530528
if (curr_ext_hdr_type == IP6_ROUTING) {
531-
info->rss_ex_dst_valid =
532-
_eth_get_rss_ex_dst_addr(pkt, pkt_frags,
533-
ip6hdr_off + info->full_hdr_len,
534-
&ext_hdr, &info->rss_ex_dst);
529+
if (ext_hdr.ip6r_len == sizeof(struct in6_address) / 8) {
530+
info->rss_ex_dst_valid =
531+
_eth_get_rss_ex_dst_addr(pkt, pkt_frags,
532+
ip6hdr_off + info->full_hdr_len,
533+
&ext_hdr, &info->rss_ex_dst);
534+
}
535535
} else if (curr_ext_hdr_type == IP6_DESTINATON) {
536536
info->rss_ex_src_valid =
537537
_eth_get_rss_ex_src_addr(pkt, pkt_frags,

0 commit comments

Comments
 (0)