[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 39/48] igb: Filter with the second VLAN tag for extended VLAN
From: |
Akihiko Odaki |
Subject: |
[PATCH v4 39/48] igb: Filter with the second VLAN tag for extended VLAN |
Date: |
Wed, 26 Apr 2023 19:37:07 +0900 |
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/net/igb_core.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c
index 688eaf7319..5345f57031 100644
--- a/hw/net/igb_core.c
+++ b/hw/net/igb_core.c
@@ -69,7 +69,7 @@ typedef struct IGBTxPktVmdqCallbackContext {
typedef struct L2Header {
struct eth_header eth;
- struct vlan_header vlan;
+ struct vlan_header vlan[2];
} L2Header;
static ssize_t
@@ -1001,7 +1001,7 @@ static uint16_t igb_receive_assign(IGBCore *core, const
L2Header *l2_header,
uint32_t f, ra[2], *macp, rctl = core->mac[RCTL];
uint16_t queues = 0;
uint16_t oversized = 0;
- uint16_t vid = be16_to_cpu(l2_header->vlan.h_tci) & VLAN_VID_MASK;
+ size_t vlan_num = 0;
int i;
memset(rss_info, 0, sizeof(E1000E_RSSInfo));
@@ -1010,8 +1010,19 @@ static uint16_t igb_receive_assign(IGBCore *core, const
L2Header *l2_header,
*external_tx = true;
}
- if (e1000x_is_vlan_packet(ehdr, core->mac[VET] & 0xffff) &&
- !e1000x_rx_vlan_filter(core->mac, PKT_GET_VLAN_HDR(ehdr))) {
+ if (core->mac[CTRL_EXT] & BIT(26)) {
+ if (be16_to_cpu(ehdr->h_proto) == core->mac[VET] >> 16 &&
+ be16_to_cpu(l2_header->vlan[0].h_proto) == (core->mac[VET] &
0xffff)) {
+ vlan_num = 2;
+ }
+ } else {
+ if (be16_to_cpu(ehdr->h_proto) == (core->mac[VET] & 0xffff)) {
+ vlan_num = 1;
+ }
+ }
+
+ if (vlan_num &&
+ !e1000x_rx_vlan_filter(core->mac, l2_header->vlan + vlan_num - 1)) {
return queues;
}
@@ -1065,7 +1076,9 @@ static uint16_t igb_receive_assign(IGBCore *core, const
L2Header *l2_header,
if (e1000x_vlan_rx_filter_enabled(core->mac)) {
uint16_t mask = 0;
- if (e1000x_is_vlan_packet(ehdr, core->mac[VET] & 0xffff)) {
+ if (vlan_num) {
+ uint16_t vid = be16_to_cpu(l2_header->vlan[vlan_num -
1].h_tci) & VLAN_VID_MASK;
+
for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) {
if ((core->mac[VLVF0 + i] & E1000_VLVF_VLANID_MASK) == vid
&&
(core->mac[VLVF0 + i] & E1000_VLVF_VLANID_ENABLE)) {
--
2.40.0
- [PATCH v4 29/48] igb: Rename a variable in igb_receive_internal(), (continued)
- [PATCH v4 29/48] igb: Rename a variable in igb_receive_internal(), Akihiko Odaki, 2023/04/26
- [PATCH v4 30/48] net/eth: Use void pointers, Akihiko Odaki, 2023/04/26
- [PATCH v4 31/48] net/eth: Always add VLAN tag, Akihiko Odaki, 2023/04/26
- [PATCH v4 32/48] hw/net/net_rx_pkt: Enforce alignment for eth_header, Akihiko Odaki, 2023/04/26
- [PATCH v4 33/48] tests/qtest/libqos/igb: Set GPIE.Multiple_MSIX, Akihiko Odaki, 2023/04/26
- [PATCH v4 34/48] igb: Implement MSI-X single vector mode, Akihiko Odaki, 2023/04/26
- [PATCH v4 35/48] igb: Use UDP for RSS hash, Akihiko Odaki, 2023/04/26
- [PATCH v4 36/48] igb: Implement Rx SCTP CSO, Akihiko Odaki, 2023/04/26
- [PATCH v4 37/48] igb: Implement Tx SCTP CSO, Akihiko Odaki, 2023/04/26
- [PATCH v4 38/48] igb: Strip the second VLAN tag for extended VLAN, Akihiko Odaki, 2023/04/26
- [PATCH v4 39/48] igb: Filter with the second VLAN tag for extended VLAN,
Akihiko Odaki <=
- [PATCH v4 40/48] igb: Implement igb-specific oversize check, Akihiko Odaki, 2023/04/26
- [PATCH v4 41/48] igb: Implement Rx PTP2 timestamp, Akihiko Odaki, 2023/04/26
- [PATCH v4 42/48] igb: Implement Tx timestamp, Akihiko Odaki, 2023/04/26
- [PATCH v4 43/48] e1000e: Notify only new interrupts, Akihiko Odaki, 2023/04/26
- [PATCH v4 44/48] igb: Notify only new interrupts, Akihiko Odaki, 2023/04/26
- [PATCH v4 45/48] igb: Clear-on-read ICR when ICR.INTA is set, Akihiko Odaki, 2023/04/26
- [PATCH v4 46/48] vmxnet3: Do not depend on PC, Akihiko Odaki, 2023/04/26
- [PATCH v4 47/48] MAINTAINERS: Add a reviewer for network packet abstractions, Akihiko Odaki, 2023/04/26