mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986)
@ 2026-11-03  6:38 Minhong He
  2026-11-03  6:38 ` [PATCH net-next 1/3] seg6_local: implement USP flavor for the End behavior Minhong He
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Minhong He @ 2026-11-03  6:38 UTC (permalink / raw)
  To: andrea.mayer, davem, edumazet, kuba, pabeni, netdev
  Cc: horms, linux-kernel, Minhong He

RFC 8986 defines the PSP, USP and USD flavors for the SRv6 End
behaviors. Currently, the Linux SRv6 implementation (seg6_local)
only supports the PSP flavor (combined with the NEXT-C-SID
flavor).

This patch series adds support for the USP (Ultimate Segment Pop
of the SRH) flavor to the End, End.X and End.T behaviors, and for
the USD (Ultimate Segment Decapsulation) flavor to the SRv6 End
behaviors that perform the decapsulation of the packet (i.e.,
End.DX4, End.DX6, End.DT4, End.DT6, End.DT46).

Patch overview:

- Patch 1 implements the USP flavor for the End behavior by
  extending the RFC 8986 flavor action table with the entries
  required to process the combinations of packet info and the USP
  flavor (either alone or combined with the PSP flavor);

- Patch 2 adds the USD flavor support to the decap behaviors.
  Since these behaviors already remove the outer IPv6 header (and,
  as a consequence, the SRH too) as part of the decapsulation
  process, the USD flavor is only supported at the control plane
  level, to ease the interoperability with control planes (e.g.,
  IS-IS, BGP-LS) which can advertise SIDs with the USD flavor;

- Patch 3 extends the USP flavor support to the End.X and End.T
  behaviors, which can now take advantage of the flavor action
  table mechanism introduced in patch 1.

The series has been applied and tested on top of linux-next
(next-20261102).

Minhong He (3):
  seg6_local: implement USP flavor for the End behavior
  seg6_local: support USD flavor for decap behaviors
  seg6_local: add USP flavor support to End.X and End.T

 net/ipv6/seg6_local.c | 163 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 143 insertions(+), 20 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] seg6_local: implement USP flavor for the End behavior
  2026-11-03  6:38 [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Minhong He
@ 2026-11-03  6:38 ` Minhong He
  2026-11-03  6:38 ` [PATCH net-next 2/3] seg6_local: support USD flavor for decap behaviors Minhong He
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Minhong He @ 2026-11-03  6:38 UTC (permalink / raw)
  To: andrea.mayer, davem, edumazet, kuba, pabeni, netdev
  Cc: horms, linux-kernel, Minhong He

RFC 8986 defines the USP (Ultimate Segment Pop of the SRH) flavor
which requires the SRH to be removed by the ultimate segment of the
SRv6 path, i.e., the segment identified by the DA of the packet with
Segments Left == 0.

Currently, the End behavior only supports the PSP flavor. Let's add
support for the USP flavor by:

  - extending the set of supported RFC 8986 flavor operations with
    the USP flavor (SEG6_F_LOCAL_FLV_USP);

  - enriching the flavor action table with the entries required to
    process the combinations of packet info (i.e., SRH with SL=0,
    SL=1, SL>1) and the USP flavor (either alone or combined with
    the PSP flavor).

The processing of the USP flavor is carried out by extending the
end_flv8986_core() function with a new 'finish' callback, which
performs the "final" processing of the packet depending on the
specific End* behavior (e.g., nexthop lookup for the End behavior).
This also allows the function to be reused by other End* behaviors
in follow-up patches.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 net/ipv6/seg6_local.c | 59 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 0d952514d095..bb5a0ccc3532 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -115,9 +115,18 @@ struct bpf_lwt_prog {
 #define SEG6_F_LOCAL_FLV_OP(flvname)	BIT(SEG6_LOCAL_FLV_OP_##flvname)
 #define SEG6_F_LOCAL_FLV_NEXT_CSID	SEG6_F_LOCAL_FLV_OP(NEXT_CSID)
 #define SEG6_F_LOCAL_FLV_PSP		SEG6_F_LOCAL_FLV_OP(PSP)
+#define SEG6_F_LOCAL_FLV_USP		SEG6_F_LOCAL_FLV_OP(USP)
 
-/* Supported RFC8986 Flavor operations are reported in this bitmask */
-#define SEG6_LOCAL_FLV8986_SUPP_OPS	SEG6_F_LOCAL_FLV_PSP
+/* Supported RFC8986 Flavor operations are reported in this bitmask.
+ *
+ * The bitmask is used as a mask for the RFC8986 Flavor operations that
+ * can be processed through the action table (flv8986_act_tbl) on the
+ * data plane. For this reason, it contains only the Flavor operations
+ * (i.e., PSP and USP) that are supported by the SRv6 End behaviors
+ * which rely on such a table for the processing of the packets.
+ */
+#define SEG6_LOCAL_FLV8986_SUPP_OPS	(SEG6_F_LOCAL_FLV_PSP | \
+					 SEG6_F_LOCAL_FLV_USP)
 
 #define SEG6_LOCAL_END_FLV_SUPP_OPS	(SEG6_F_LOCAL_FLV_NEXT_CSID | \
 					 SEG6_LOCAL_FLV8986_SUPP_OPS)
@@ -664,6 +673,7 @@ enum seg6_local_flv_action {
 
 /* shorthand for improving readability */
 #define F_PSP	SEG6_F_LOCAL_FLV_PSP
+#define F_USP	SEG6_F_LOCAL_FLV_USP
 
 /* The table contains, for each combination of the pktinfo data and
  * flavors, the action that should be taken on a packet (e.g.
@@ -674,13 +684,32 @@ enum seg6_local_flv_action {
  * discarding the processed packet.
  */
 static const u8 flv8986_act_tbl[FLV8986_ACT_TBL_SIZE] = {
-	/* PSP variant for packet where SRH with SL = 1 */
+	/* PSP flavor: the penultimate segment pops the outer SID
+	 * (i.e., the Segment Left pointer) from the SRH.
+	 */
 	tbl_cfg(PSP, SL_ONE, F_PSP),
-	/* End for packet where the SRH with SL > 1*/
 	tbl_cfg(END, SL_MORE, F_PSP),
+
+	/* USP flavor: the ultimate (i.e., final) segment of the SRv6 path
+	 * removes the SRH from the packet. In all the other cases, the
+	 * packet is processed as the "standard" End behavior.
+	 */
+	tbl_cfg(END, SL_ONE, F_USP),
+	tbl_cfg(END, SL_MORE, F_USP),
+	tbl_cfg(USP, SL_ZERO, F_USP),
+
+	/* When the PSP and USP flavors are combined, the PSP operation
+	 * takes place if SL=1 (i.e., the node is the penultimate segment),
+	 * while the USP operation is applied when SL=0 (i.e., the node is
+	 * the final segment of the SRv6 path).
+	 */
+	tbl_cfg(PSP, SL_ONE, F_PSP | F_USP),
+	tbl_cfg(END, SL_MORE, F_PSP | F_USP),
+	tbl_cfg(USP, SL_ZERO, F_PSP | F_USP),
 };
 
 #undef F_PSP
+#undef F_USP
 #undef tbl_cfg
 
 /* For each flavor defined in RFC8986 (or a combination of them) an action is
@@ -823,8 +852,15 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
 
 /* process the packet on the basis of the RFC8986 flavors set for the given
  * SRv6 End behavior instance.
+ *
+ * The @finish callback takes care of the "final" processing of the packet,
+ * which depends on the specific End* behavior. For instance, the End
+ * behavior performs a nexthop lookup in the default routing table, while
+ * the End.X behavior forwards the packet to the precomputed L2 adjacency.
  */
-static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
+static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt,
+			    int (*finish)(struct sk_buff *skb,
+					  struct seg6_local_lwt *slwt))
 {
 	enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
 	const struct seg6_flavors_info *finfo = &slwt->flv_info;
@@ -871,6 +907,15 @@ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 		if (unlikely(!seg6_pop_srh(skb, srhoff)))
 			goto drop;
 		break;
+	case SEG6_LOCAL_FLV_ACT_USP:
+		/* the node is the final segment of the SRv6 path: remove
+		 * the SRH from the packet without updating the IPv6 DA,
+		 * which is already pointing to the last SID (i.e.,
+		 * Segments[0]).
+		 */
+		if (unlikely(!seg6_pop_srh(skb, srhoff)))
+			goto drop;
+		break;
 	case SEG6_LOCAL_FLV_ACT_UNSPEC:
 		fallthrough;
 	default:
@@ -880,7 +925,7 @@ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 		goto drop;
 	}
 
-	return input_action_end_finish(skb, slwt);
+	return finish(skb, slwt);
 
 drop:
 	kfree_skb_reason(skb, reason);
@@ -905,7 +950,7 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 	 * information extracted from the packet, e.g. presence/absence of SRH,
 	 * Segment Left = 0, etc.
 	 */
-	return end_flv8986_core(skb, slwt);
+	return end_flv8986_core(skb, slwt, input_action_end_finish);
 }
 
 /* regular endpoint, and forward to specified nexthop */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] seg6_local: support USD flavor for decap behaviors
  2026-11-03  6:38 [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Minhong He
  2026-11-03  6:38 ` [PATCH net-next 1/3] seg6_local: implement USP flavor for the End behavior Minhong He
@ 2026-11-03  6:38 ` Minhong He
  2026-11-03  6:38 ` [PATCH net-next 3/3] seg6_local: add USP flavor support to End.X and End.T Minhong He
  2026-11-04  7:22 ` [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Hangbin Liu
  3 siblings, 0 replies; 5+ messages in thread
From: Minhong He @ 2026-11-03  6:38 UTC (permalink / raw)
  To: andrea.mayer, davem, edumazet, kuba, pabeni, netdev
  Cc: horms, linux-kernel, Minhong He

RFC 8986 defines the USD (Ultimate Segment Decapsulation) flavor for
the SRv6 End behaviors that perform the decapsulation of the packet
(i.e., End.DX4, End.DX6, End.DT4, End.DT6, End.DT46).

Since these behaviors already remove the outer IPv6 header (and, as a
consequence, the SRH too) as part of the decapsulation process, the
USD flavor requires no additional processing on the data plane with
respect to the "standard" behaviors.

For this reason, the USD flavor is only supported at the control
plane level: this way, the behaviors accept the SEG6_LOCAL_FLAVORS
attribute carrying the USD flavor, making the kernel fully compliant
with the control planes (e.g., IS-IS, BGP-LS) which can advertise
SIDs with the USD flavor.

Note that the USD flavor does not appear in the
SEG6_LOCAL_FLV8986_SUPP_OPS bitmask since it is not processed through
the flavor action table. Instead, a new bitmask
(SEG6_LOCAL_END_DECAP_FLV_SUPP_OPS) is defined and used to report the
set of flavor operations supported by the decap behaviors.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 net/ipv6/seg6_local.c | 52 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index bb5a0ccc3532..2126a79b1e0c 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -116,6 +116,7 @@ struct bpf_lwt_prog {
 #define SEG6_F_LOCAL_FLV_NEXT_CSID	SEG6_F_LOCAL_FLV_OP(NEXT_CSID)
 #define SEG6_F_LOCAL_FLV_PSP		SEG6_F_LOCAL_FLV_OP(PSP)
 #define SEG6_F_LOCAL_FLV_USP		SEG6_F_LOCAL_FLV_OP(USP)
+#define SEG6_F_LOCAL_FLV_USD		SEG6_F_LOCAL_FLV_OP(USD)
 
 /* Supported RFC8986 Flavor operations are reported in this bitmask.
  *
@@ -124,6 +125,11 @@ struct bpf_lwt_prog {
  * data plane. For this reason, it contains only the Flavor operations
  * (i.e., PSP and USP) that are supported by the SRv6 End behaviors
  * which rely on such a table for the processing of the packets.
+ *
+ * The USD Flavor does not appear in this bitmask since it applies to
+ * SRv6 End behaviors that perform decapsulation. Such behaviors do not
+ * make use of the action table: see SEG6_LOCAL_END_DECAP_FLV_SUPP_OPS
+ * for more details.
  */
 #define SEG6_LOCAL_FLV8986_SUPP_OPS	(SEG6_F_LOCAL_FLV_PSP | \
 					 SEG6_F_LOCAL_FLV_USP)
@@ -132,6 +138,18 @@ struct bpf_lwt_prog {
 					 SEG6_LOCAL_FLV8986_SUPP_OPS)
 #define SEG6_LOCAL_END_X_FLV_SUPP_OPS	SEG6_F_LOCAL_FLV_NEXT_CSID
 
+/* The USD Flavor applies to the SRv6 End behaviors that perform the
+ * decapsulation of the packet (e.g., End.DX4, End.DX6, End.DT4, End.DT6,
+ * End.DT46).
+ * In this case, the removal of the SRH is carried out as part of the
+ * decapsulation process and, therefore, no additional processing is
+ * required on the data plane with respect to the "standard" behaviors.
+ * The Flavor is reported to user space only for completeness and to
+ * ease the interoperability with control planes (e.g., IS-IS, BGP)
+ * which can advertise SIDs with the USD Flavor.
+ */
+#define SEG6_LOCAL_END_DECAP_FLV_SUPP_OPS	SEG6_F_LOCAL_FLV_USD
+
 struct seg6_flavors_info {
 	/* Flavor operations */
 	__u32 flv_ops;
@@ -573,6 +591,22 @@ static int seg6_flv_supp_ops_by_action(int action, __u32 *fops)
 	case SEG6_LOCAL_ACTION_END_X:
 		*fops = SEG6_LOCAL_END_X_FLV_SUPP_OPS;
 		break;
+	case SEG6_LOCAL_ACTION_END_DX4:
+	case SEG6_LOCAL_ACTION_END_DX6:
+	case SEG6_LOCAL_ACTION_END_DT4:
+	case SEG6_LOCAL_ACTION_END_DT6:
+	case SEG6_LOCAL_ACTION_END_DT46:
+		/* the USD flavor applies to the SRv6 End behaviors that
+		 * decapsulate the packet. Since such behaviors already
+		 * remove the outer IPv6 header (and, as a consequence, the
+		 * SRH too) as part of the decapsulation process, the USD
+		 * flavor requires no additional processing on the data
+		 * plane. The flavor is supported for completeness and to
+		 * ease the interoperability with control planes that may
+		 * advertise SIDs with the USD flavor.
+		 */
+		*fops = SEG6_LOCAL_END_DECAP_FLV_SUPP_OPS;
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -1694,19 +1728,22 @@ static struct seg6_action_desc seg6_action_table[] = {
 	{
 		.action		= SEG6_LOCAL_ACTION_END_DX6,
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_NH6),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 		.input		= input_action_end_dx6,
 	},
 	{
 		.action		= SEG6_LOCAL_ACTION_END_DX4,
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_NH4),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 		.input		= input_action_end_dx4,
 	},
 	{
 		.action		= SEG6_LOCAL_ACTION_END_DT4,
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 #ifdef CONFIG_NET_L3_MASTER_DEV
 		.input		= input_action_end_dt4,
 		.slwt_ops	= {
@@ -1720,20 +1757,23 @@ static struct seg6_action_desc seg6_action_table[] = {
 		.attrs		= 0,
 		.optattrs	= SEG6_F_LOCAL_COUNTERS		|
 				  SEG6_F_ATTR(SEG6_LOCAL_TABLE) |
-				  SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE),
+				  SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE) |
+				  SEG6_F_LOCAL_FLAVORS,
 		.slwt_ops	= {
 					.build_state = seg6_end_dt6_build,
 				  },
 #else
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_TABLE),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 #endif
 		.input		= input_action_end_dt6,
 	},
 	{
 		.action		= SEG6_LOCAL_ACTION_END_DT46,
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 #ifdef CONFIG_NET_L3_MASTER_DEV
 		.input		= input_action_end_dt46,
 		.slwt_ops	= {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] seg6_local: add USP flavor support to End.X and End.T
  2026-11-03  6:38 [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Minhong He
  2026-11-03  6:38 ` [PATCH net-next 1/3] seg6_local: implement USP flavor for the End behavior Minhong He
  2026-11-03  6:38 ` [PATCH net-next 2/3] seg6_local: support USD flavor for decap behaviors Minhong He
@ 2026-11-03  6:38 ` Minhong He
  2026-11-04  7:22 ` [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Hangbin Liu
  3 siblings, 0 replies; 5+ messages in thread
From: Minhong He @ 2026-11-03  6:38 UTC (permalink / raw)
  To: andrea.mayer, davem, edumazet, kuba, pabeni, netdev
  Cc: horms, linux-kernel, Minhong He

RFC 8986 states that the End.X and End.T behaviors support both the
PSP and USP flavors.

The End.X behavior can now take advantage of the flavor action table
mechanism introduced by the previous patch: the 'finish' callback is
set to input_action_end_x_finish() so that the packet is forwarded to
the precomputed L2 adjacency once the SRH has been processed
according to the flavors and the packet info.

The End.T behavior is restructured in the same way as the End.X
behavior:
  - input_action_end_t_finish() takes care of the lookup in the
    routing table specified for the End.T behavior;
  - input_action_end_t_core() implements the "standard" End.T
    behavior;
  - input_action_end_t() routes the packet to the flavor-based
    processing (i.e., end_flv8986_core()) when the PSP and/or USP
    flavors are configured.

Finally, the End.T behavior now accepts the SEG6_LOCAL_FLAVORS
attribute and reports the PSP and USP flavors as supported
operations.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 net/ipv6/seg6_local.c | 52 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 2126a79b1e0c..d14b84571e4f 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -136,7 +136,11 @@ struct bpf_lwt_prog {
 
 #define SEG6_LOCAL_END_FLV_SUPP_OPS	(SEG6_F_LOCAL_FLV_NEXT_CSID | \
 					 SEG6_LOCAL_FLV8986_SUPP_OPS)
-#define SEG6_LOCAL_END_X_FLV_SUPP_OPS	SEG6_F_LOCAL_FLV_NEXT_CSID
+#define SEG6_LOCAL_END_X_FLV_SUPP_OPS	(SEG6_F_LOCAL_FLV_NEXT_CSID | \
+					 SEG6_F_LOCAL_FLV_PSP | \
+					 SEG6_F_LOCAL_FLV_USP)
+#define SEG6_LOCAL_END_T_FLV_SUPP_OPS	(SEG6_F_LOCAL_FLV_PSP | \
+					 SEG6_F_LOCAL_FLV_USP)
 
 /* The USD Flavor applies to the SRv6 End behaviors that perform the
  * decapsulation of the packet (e.g., End.DX4, End.DX6, End.DT4, End.DT6,
@@ -591,6 +595,9 @@ static int seg6_flv_supp_ops_by_action(int action, __u32 *fops)
 	case SEG6_LOCAL_ACTION_END_X:
 		*fops = SEG6_LOCAL_END_X_FLV_SUPP_OPS;
 		break;
+	case SEG6_LOCAL_ACTION_END_T:
+		*fops = SEG6_LOCAL_END_T_FLV_SUPP_OPS;
+		break;
 	case SEG6_LOCAL_ACTION_END_DX4:
 	case SEG6_LOCAL_ACTION_END_DX6:
 	case SEG6_LOCAL_ACTION_END_DT4:
@@ -993,14 +1000,31 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 	const struct seg6_flavors_info *finfo = &slwt->flv_info;
 	__u32 fops = finfo->flv_ops;
 
+	if (!fops)
+		return input_action_end_x_core(skb, slwt);
+
 	/* check for the presence of NEXT-C-SID since it applies first */
 	if (seg6_next_csid_enabled(fops))
 		return end_x_next_csid_core(skb, slwt);
 
-	return input_action_end_x_core(skb, slwt);
+	/* the specific processing function to be performed on the packet
+	 * depends on the combination of flavors defined in RFC8986 and some
+	 * information extracted from the packet, e.g. presence/absence of SRH,
+	 * Segment Left = 0, etc.
+	 */
+	return end_flv8986_core(skb, slwt, input_action_end_x_finish);
 }
 
-static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
+static int input_action_end_t_finish(struct sk_buff *skb,
+				     struct seg6_local_lwt *slwt)
+{
+	seg6_lookup_nexthop(skb, NULL, slwt->table);
+
+	return dst_input(skb);
+}
+
+static int input_action_end_t_core(struct sk_buff *skb,
+				   struct seg6_local_lwt *slwt)
 {
 	enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
 	struct ipv6_sr_hdr *srh;
@@ -1016,15 +1040,28 @@ static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
 		goto drop;
 	}
 
-	seg6_lookup_nexthop(skb, NULL, slwt->table);
-
-	return dst_input(skb);
+	return input_action_end_t_finish(skb, slwt);
 
 drop:
 	kfree_skb_reason(skb, reason);
 	return err;
 }
 
+static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
+{
+	const struct seg6_flavors_info *finfo = &slwt->flv_info;
+	__u32 fops = finfo->flv_ops;
+
+	/* The End.T behavior supports the PSP and USP flavors. In all the
+	 * cases where these flavors do not apply (i.e., SRH with SL > 1),
+	 * the packet is processed as the "standard" End.T behavior.
+	 */
+	if (fops & (SEG6_F_LOCAL_FLV_PSP | SEG6_F_LOCAL_FLV_USP))
+		return end_flv8986_core(skb, slwt, input_action_end_t_finish);
+
+	return input_action_end_t_core(skb, slwt);
+}
+
 /* decapsulate and forward inner L2 frame on specified interface */
 static int input_action_end_dx2(struct sk_buff *skb,
 				struct seg6_local_lwt *slwt)
@@ -1716,7 +1753,8 @@ static struct seg6_action_desc seg6_action_table[] = {
 	{
 		.action		= SEG6_LOCAL_ACTION_END_T,
 		.attrs		= SEG6_F_ATTR(SEG6_LOCAL_TABLE),
-		.optattrs	= SEG6_F_LOCAL_COUNTERS,
+		.optattrs	= SEG6_F_LOCAL_COUNTERS |
+				  SEG6_F_LOCAL_FLAVORS,
 		.input		= input_action_end_t,
 	},
 	{
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986)
  2026-11-03  6:38 [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Minhong He
                   ` (2 preceding siblings ...)
  2026-11-03  6:38 ` [PATCH net-next 3/3] seg6_local: add USP flavor support to End.X and End.T Minhong He
@ 2026-11-04  7:22 ` Hangbin Liu
  3 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-11-04  7:22 UTC (permalink / raw)
  To: Minhong He
  Cc: andrea.mayer, davem, edumazet, kuba, pabeni, netdev, horms,
	linux-kernel, Andrea Mayer

Hi Minhong,
On Tue, Nov 03, 2026 at 02:38:03PM +0800, Minhong He wrote:
> RFC 8986 defines the PSP, USP and USD flavors for the SRv6 End
> behaviors. Currently, the Linux SRv6 implementation (seg6_local)
> only supports the PSP flavor (combined with the NEXT-C-SID
> flavor).

No, the kernel will not process PSP when it is combined with
NEXT-C-SID at present.

> 
> This patch series adds support for the USP (Ultimate Segment Pop
> of the SRH) flavor to the End, End.X and End.T behaviors, and for
> the USD (Ultimate Segment Decapsulation) flavor to the SRv6 End
> behaviors that perform the decapsulation of the packet (i.e.,
> End.DX4, End.DX6, End.DT4, End.DT6, End.DT46).

Thanks for the patch. Unfortunately, I have already started this work back
in September. I discussed my plan with Andrea at that time. Sadly, I did not
mention this in the cover letter for my PSP support series[1], that’s my mistake.
I didn’t expect someone would skip PSP and start with USP/USD directly.

Kernel changes alone are not sufficient, we also need selftest updates for
this new feature. So I’ve begun adding PSP support for End.X, along with the
corresponding selftests. The USP/USD kernel updates are already in my local
tree.

That said, there is a sequence for landing new features. Right now we need
to wait for Andrea’s NEXT-C-SID and PSP series[2] to get merged into net-next
first.

[1] https://lore.kernel.org/netdev/20260922-srv6_flavors_endx-v1-0-4d01c05c47b7@kylinos.cn/
[2] https://lore.kernel.org/netdev/20261011192310.55-1-andrea.mayer@uniroma2.it/

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-04  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  6:38 [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Minhong He
2026-11-03  6:38 ` [PATCH net-next 1/3] seg6_local: implement USP flavor for the End behavior Minhong He
2026-11-03  6:38 ` [PATCH net-next 2/3] seg6_local: support USD flavor for decap behaviors Minhong He
2026-11-03  6:38 ` [PATCH net-next 3/3] seg6_local: add USP flavor support to End.X and End.T Minhong He
2026-11-04  7:22 ` [PATCH net-next 0/3] seg6_local: add USP and USD flavors support (RFC 8986) Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®