Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'octeontx2-af-tc-flower-offload-changes'

Suman Ghosh says:

====================
octeontx2-af: TC flower offload changes

This patchset includes minor code restructuring related to TC
flower offload for outer vlan and adding support for TC inner
vlan offload.

Patch #1 Code restructure to handle TC flower outer vlan offload

Patch #2 Add TC flower offload support for inner vlan
====================

Link: https://lore.kernel.org/r/20230804045935.3010554-1-sumang@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+89 -38
+1
drivers/net/ethernet/marvell/octeontx2/af/mbox.h
··· 1465 1465 u8 ip_flag; 1466 1466 u8 next_header; 1467 1467 }; 1468 + __be16 vlan_itci; 1468 1469 }; 1469 1470 1470 1471 struct npc_install_flow_req {
+3
drivers/net/ethernet/marvell/octeontx2/af/npc.h
··· 184 184 NPC_VLAN_ETYPE_CTAG, /* 0x8100 */ 185 185 NPC_VLAN_ETYPE_STAG, /* 0x88A8 */ 186 186 NPC_OUTER_VID, 187 + NPC_INNER_VID, 187 188 NPC_TOS, 188 189 NPC_IPFRAG_IPV4, 189 190 NPC_SIP_IPV4, ··· 231 230 NPC_VLAN_TAG1, 232 231 /* outer vlan tci for double tagged frame */ 233 232 NPC_VLAN_TAG2, 233 + /* inner vlan tci for double tagged frame */ 234 + NPC_VLAN_TAG3, 234 235 /* other header fields programmed to extract but not of our interest */ 235 236 NPC_UNKNOWN, 236 237 NPC_KEY_FIELDS_MAX,
+5
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
··· 2787 2787 seq_printf(s, "mask 0x%x\n", 2788 2788 ntohs(rule->mask.vlan_tci)); 2789 2789 break; 2790 + case NPC_INNER_VID: 2791 + seq_printf(s, "0x%x ", ntohs(rule->packet.vlan_itci)); 2792 + seq_printf(s, "mask 0x%x\n", 2793 + ntohs(rule->mask.vlan_itci)); 2794 + break; 2790 2795 case NPC_TOS: 2791 2796 seq_printf(s, "%d ", rule->packet.tos); 2792 2797 seq_printf(s, "mask 0x%x\n", rule->mask.tos);
+13
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
··· 20 20 [NPC_VLAN_ETYPE_CTAG] = "vlan ether type ctag", 21 21 [NPC_VLAN_ETYPE_STAG] = "vlan ether type stag", 22 22 [NPC_OUTER_VID] = "outer vlan id", 23 + [NPC_INNER_VID] = "inner vlan id", 23 24 [NPC_TOS] = "tos", 24 25 [NPC_IPFRAG_IPV4] = "fragmented IPv4 header ", 25 26 [NPC_SIP_IPV4] = "ipv4 source ip", ··· 329 328 */ 330 329 struct npc_key_field *vlan_tag1; 331 330 struct npc_key_field *vlan_tag2; 331 + /* Inner VLAN TCI for double tagged frames */ 332 + struct npc_key_field *vlan_tag3; 332 333 u64 *features; 333 334 u8 start_lid; 334 335 int i; ··· 353 350 etype_tag2 = &key_fields[NPC_ETYPE_TAG2]; 354 351 vlan_tag1 = &key_fields[NPC_VLAN_TAG1]; 355 352 vlan_tag2 = &key_fields[NPC_VLAN_TAG2]; 353 + vlan_tag3 = &key_fields[NPC_VLAN_TAG3]; 356 354 357 355 /* if key profile programmed does not extract Ethertype at all */ 358 356 if (!etype_ether->nr_kws && !etype_tag1->nr_kws && !etype_tag2->nr_kws) { ··· 435 431 goto done; 436 432 } 437 433 *features |= BIT_ULL(NPC_OUTER_VID); 434 + 435 + /* If key profile extracts inner vlan tci */ 436 + if (vlan_tag3->nr_kws) { 437 + key_fields[NPC_INNER_VID] = *vlan_tag3; 438 + *features |= BIT_ULL(NPC_INNER_VID); 439 + } 438 440 done: 439 441 return; 440 442 } ··· 523 513 NPC_SCAN_HDR(NPC_ETYPE_TAG2, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8, 2); 524 514 NPC_SCAN_HDR(NPC_VLAN_TAG1, NPC_LID_LB, NPC_LT_LB_CTAG, 2, 2); 525 515 NPC_SCAN_HDR(NPC_VLAN_TAG2, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 2, 2); 516 + NPC_SCAN_HDR(NPC_VLAN_TAG3, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 6, 2); 526 517 NPC_SCAN_HDR(NPC_DMAC, NPC_LID_LA, la_ltype, la_start, 6); 527 518 528 519 NPC_SCAN_HDR(NPC_IPSEC_SPI, NPC_LID_LD, NPC_LT_LD_AH, 4, 4); ··· 954 943 955 944 NPC_WRITE_FLOW(NPC_OUTER_VID, vlan_tci, ntohs(pkt->vlan_tci), 0, 956 945 ntohs(mask->vlan_tci), 0); 946 + NPC_WRITE_FLOW(NPC_INNER_VID, vlan_itci, ntohs(pkt->vlan_itci), 0, 947 + ntohs(mask->vlan_itci), 0); 957 948 958 949 NPC_WRITE_FLOW(NPC_IPFRAG_IPV6, next_header, pkt->next_header, 0, 959 950 mask->next_header, 0);
+67 -38
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
··· 439 439 return 0; 440 440 } 441 441 442 + static int otx2_tc_process_vlan(struct otx2_nic *nic, struct flow_msg *flow_spec, 443 + struct flow_msg *flow_mask, struct flow_rule *rule, 444 + struct npc_install_flow_req *req, bool is_inner) 445 + { 446 + struct flow_match_vlan match; 447 + u16 vlan_tci, vlan_tci_mask; 448 + 449 + if (is_inner) 450 + flow_rule_match_cvlan(rule, &match); 451 + else 452 + flow_rule_match_vlan(rule, &match); 453 + 454 + if (!eth_type_vlan(match.key->vlan_tpid)) { 455 + netdev_err(nic->netdev, "vlan tpid 0x%x not supported\n", 456 + ntohs(match.key->vlan_tpid)); 457 + return -EOPNOTSUPP; 458 + } 459 + 460 + if (!match.mask->vlan_id) { 461 + struct flow_action_entry *act; 462 + int i; 463 + 464 + flow_action_for_each(i, act, &rule->action) { 465 + if (act->id == FLOW_ACTION_DROP) { 466 + netdev_err(nic->netdev, 467 + "vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n", 468 + ntohs(match.key->vlan_tpid), match.key->vlan_id); 469 + return -EOPNOTSUPP; 470 + } 471 + } 472 + } 473 + 474 + if (match.mask->vlan_id || 475 + match.mask->vlan_dei || 476 + match.mask->vlan_priority) { 477 + vlan_tci = match.key->vlan_id | 478 + match.key->vlan_dei << 12 | 479 + match.key->vlan_priority << 13; 480 + 481 + vlan_tci_mask = match.mask->vlan_id | 482 + match.mask->vlan_dei << 12 | 483 + match.mask->vlan_priority << 13; 484 + if (is_inner) { 485 + flow_spec->vlan_itci = htons(vlan_tci); 486 + flow_mask->vlan_itci = htons(vlan_tci_mask); 487 + req->features |= BIT_ULL(NPC_INNER_VID); 488 + } else { 489 + flow_spec->vlan_tci = htons(vlan_tci); 490 + flow_mask->vlan_tci = htons(vlan_tci_mask); 491 + req->features |= BIT_ULL(NPC_OUTER_VID); 492 + } 493 + } 494 + 495 + return 0; 496 + } 497 + 442 498 static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node, 443 499 struct flow_cls_offload *f, 444 500 struct npc_install_flow_req *req) ··· 514 458 BIT_ULL(FLOW_DISSECTOR_KEY_BASIC) | 515 459 BIT_ULL(FLOW_DISSECTOR_KEY_ETH_ADDRS) | 516 460 BIT_ULL(FLOW_DISSECTOR_KEY_VLAN) | 461 + BIT(FLOW_DISSECTOR_KEY_CVLAN) | 517 462 BIT_ULL(FLOW_DISSECTOR_KEY_IPV4_ADDRS) | 518 463 BIT_ULL(FLOW_DISSECTOR_KEY_IPV6_ADDRS) | 519 464 BIT_ULL(FLOW_DISSECTOR_KEY_PORTS) | ··· 648 591 } 649 592 650 593 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) { 651 - struct flow_match_vlan match; 652 - u16 vlan_tci, vlan_tci_mask; 594 + int ret; 653 595 654 - flow_rule_match_vlan(rule, &match); 596 + ret = otx2_tc_process_vlan(nic, flow_spec, flow_mask, rule, req, false); 597 + if (ret) 598 + return ret; 599 + } 655 600 656 - if (ntohs(match.key->vlan_tpid) != ETH_P_8021Q) { 657 - netdev_err(nic->netdev, "vlan tpid 0x%x not supported\n", 658 - ntohs(match.key->vlan_tpid)); 659 - return -EOPNOTSUPP; 660 - } 601 + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CVLAN)) { 602 + int ret; 661 603 662 - if (!match.mask->vlan_id) { 663 - struct flow_action_entry *act; 664 - int i; 665 - 666 - flow_action_for_each(i, act, &rule->action) { 667 - if (act->id == FLOW_ACTION_DROP) { 668 - netdev_err(nic->netdev, 669 - "vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n", 670 - ntohs(match.key->vlan_tpid), 671 - match.key->vlan_id); 672 - return -EOPNOTSUPP; 673 - } 674 - } 675 - } 676 - 677 - if (match.mask->vlan_id || 678 - match.mask->vlan_dei || 679 - match.mask->vlan_priority) { 680 - vlan_tci = match.key->vlan_id | 681 - match.key->vlan_dei << 12 | 682 - match.key->vlan_priority << 13; 683 - 684 - vlan_tci_mask = match.mask->vlan_id | 685 - match.mask->vlan_dei << 12 | 686 - match.mask->vlan_priority << 13; 687 - 688 - flow_spec->vlan_tci = htons(vlan_tci); 689 - flow_mask->vlan_tci = htons(vlan_tci_mask); 690 - req->features |= BIT_ULL(NPC_OUTER_VID); 691 - } 604 + ret = otx2_tc_process_vlan(nic, flow_spec, flow_mask, rule, req, true); 605 + if (ret) 606 + return ret; 692 607 } 693 608 694 609 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {