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.

net: ti: icssg: Add HSR/PRP protocol frame filtering

Add support for HSR and PRP protocol frame filtering in the ICSSG
classifier by configuring filter table 3 (FT3) to detect PTP frames
(EtherType 0x88F7) in HSR/PRP tagged packets.

Also add rx_class_or_base to miig_rt_offsets structure to support
RX_CLASS_OR register access, and fix typos in FT1_N_REG and FT3_N_REG
macros (slize -> slice).

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Link: https://patch.msgid.link/20260227174254.3821443-1-danishanwar@ti.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

MD Danish Anwar and committed by
Paolo Abeni
f56438a7 c006396f

+75 -2
+67 -2
drivers/net/ethernet/ti/icssg/icssg_classifier.c
··· 27 27 #define FT1_DA0_MASK 0x8 28 28 #define FT1_DA1_MASK 0xc 29 29 30 - #define FT1_N_REG(slize, n, reg) \ 30 + #define FT1_N_REG(slice, n, reg) \ 31 31 (offs[slice].ft1_slot_base + FT1_SLOT_SIZE * (n) + (reg)) 32 32 33 33 #define FT1_LEN_MASK GENMASK(19, 16) ··· 62 62 #define FT3_T 0x18 63 63 #define FT3_T_MASK 0x1c 64 64 65 - #define FT3_N_REG(slize, n, reg) \ 65 + #define FT3_N_REG(slice, n, reg) \ 66 66 (offs[slice].ft3_slot_base + FT3_SLOT_SIZE * (n) + (reg)) 67 67 68 68 /* offsets from rx_class n's base */ ··· 73 73 74 74 #define RX_CLASS_N_REG(slice, n, reg) \ 75 75 (offs[slice].rx_class_base + RX_CLASS_EN_SIZE * (n) + (reg)) 76 + 77 + #define RX_CLASS_OR_REG(slice, n, reg) \ 78 + (offs[slice].rx_class_or_base + RX_CLASS_EN_SIZE * (n) + (reg)) 76 79 77 80 /* RX Class Gates */ 78 81 #define RX_CLASS_GATES_SIZE 0x4 /* bytes */ ··· 104 101 #define RX_CLASS_FT_FT1_MATCH(slot) \ 105 102 ((BIT(slot) << RX_CLASS_FT_FT1_MATCH_SHIFT) & \ 106 103 RX_CLASS_FT_FT1_MATCH_MASK) 104 + 105 + /* HSR/PRP protocol frame filtering */ 106 + #define HSR_PTP_ETHERTYPE_OFFSET 0x12 107 + #define PRP_PTP_ETHERTYPE_OFFSET 0x0C 108 + #define FT3_PTP_PATTERN 0xF788 109 + #define FT3_ETHERTYPE_MASK 0xFFFF0000U 110 + #define FT3_VLAN_MODE_BOTH 0x1 111 + #define RX_CLASS_OR_DUP_PTP 0x4200 112 + #define RX_CLASS_OR_HSR_TAG 0x4000 113 + #define RX_CLASS_GATE_PTP 0x50 114 + #define RX_CLASS_DISABLE 0x0 115 + 116 + /* HSR/PRP classifier indices */ 117 + #define CLASSIFIER_PTP_DUP 10 118 + #define CLASSIFIER_HSR_TAG 11 119 + #define FT3_PTP_SLOT 14 107 120 108 121 /* RX class type */ 109 122 enum rx_class_sel_type { ··· 152 133 u32 ft3_p_base; 153 134 u32 ft_rx_ptr; 154 135 u32 rx_class_base; 136 + u32 rx_class_or_base; 155 137 u32 rx_class_cfg1; 156 138 u32 rx_class_cfg2; 157 139 u32 rx_class_gates_base; ··· 181 161 0x308, 182 162 0x408, 183 163 0x40c, 164 + 0x410, 184 165 0x48c, 185 166 0x490, 186 167 0x494, ··· 207 186 0x8d4, 208 187 0x9d4, 209 188 0x9d8, 189 + 0x9dc, 210 190 0xa58, 211 191 0xa5c, 212 192 0xa60, ··· 489 467 rx_class_ft1_cfg_set_type(miig_rt, slice, 0, FT1_CFG_TYPE_EQ); 490 468 } 491 469 EXPORT_SYMBOL_GPL(icssg_ft1_set_mac_addr); 470 + 471 + /** 472 + * icssg_ft3_hsr_configurations - Configure filter table for HSR/PRP protocol frames 473 + * @miig_rt: Pointer to the MII-G register map 474 + * @slice: ICSSG slice number (0 or 1) 475 + * @prueth: Pointer to prueth structure to determine HSR/PRP mode 476 + * 477 + * Configures FT3 to detect PTP frames (EtherType 0x88F7) in HSR/PRP tagged packets. 478 + * HSR frames have a 6-byte tag, while PRP has no tag offset for EtherType detection. 479 + */ 480 + void icssg_ft3_hsr_configurations(struct regmap *miig_rt, int slice, 481 + struct prueth *prueth) 482 + { 483 + u8 offset = (prueth->hsr_prp_version == PRP_V1) ? 484 + PRP_PTP_ETHERTYPE_OFFSET : HSR_PTP_ETHERTYPE_OFFSET; 485 + 486 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_START), offset); 487 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_START_AUTO), 0); 488 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_START_OFFSET), 0); 489 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_JUMP_OFFSET), 0); 490 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_LEN), 0); 491 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_CFG), FT3_VLAN_MODE_BOTH); 492 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_T), FT3_PTP_PATTERN); 493 + regmap_write(miig_rt, FT3_N_REG(slice, FT3_PTP_SLOT, FT3_T_MASK), 494 + FT3_ETHERTYPE_MASK); 495 + 496 + regmap_write(miig_rt, RX_CLASS_N_REG(slice, CLASSIFIER_PTP_DUP, RX_CLASS_AND_EN), 497 + RX_CLASS_DISABLE); 498 + regmap_write(miig_rt, RX_CLASS_OR_REG(slice, CLASSIFIER_PTP_DUP, RX_CLASS_OR_EN), 499 + RX_CLASS_OR_DUP_PTP); 500 + regmap_write(miig_rt, RX_CLASS_GATES_N_REG(slice, CLASSIFIER_PTP_DUP), 501 + RX_CLASS_GATE_PTP); 502 + 503 + if (prueth->hsr_prp_version != PRP_V1) { 504 + regmap_write(miig_rt, RX_CLASS_N_REG(slice, CLASSIFIER_HSR_TAG, RX_CLASS_AND_EN), 505 + RX_CLASS_DISABLE); 506 + regmap_write(miig_rt, RX_CLASS_OR_REG(slice, CLASSIFIER_HSR_TAG, RX_CLASS_OR_EN), 507 + RX_CLASS_OR_HSR_TAG); 508 + regmap_write(miig_rt, RX_CLASS_GATES_N_REG(slice, CLASSIFIER_HSR_TAG), 509 + RX_CLASS_GATE_PTP); 510 + } 511 + } 512 + EXPORT_SYMBOL_GPL(icssg_ft3_hsr_configurations);
+6
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 260 260 icssg_class_default(prueth->miig_rt, ICSS_SLICE0, 0, false); 261 261 icssg_class_default(prueth->miig_rt, ICSS_SLICE1, 0, false); 262 262 263 + /* Configure HSR/PRP protocol filtering if in HSR offload mode */ 264 + if (prueth->is_hsr_offload_mode) { 265 + icssg_ft3_hsr_configurations(prueth->miig_rt, ICSS_SLICE0, prueth); 266 + icssg_ft3_hsr_configurations(prueth->miig_rt, ICSS_SLICE1, prueth); 267 + } 268 + 263 269 if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) 264 270 icssg_init_fw_offload_mode(prueth); 265 271 else
+2
drivers/net/ethernet/ti/icssg/icssg_prueth.h
··· 423 423 void icssg_class_add_mcast_sr1(struct regmap *miig_rt, int slice, 424 424 struct net_device *ndev); 425 425 void icssg_ft1_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac_addr); 426 + void icssg_ft3_hsr_configurations(struct regmap *miig_rt, int slice, 427 + struct prueth *prueth); 426 428 427 429 /* config helpers */ 428 430 void icssg_config_ipg(struct prueth_emac *emac);