A method implemented in an electronic device in a software-defined networking, SDN, system, wherein the electronic device serves as a SDN controller in the SDN system, the method comprising: receiving a plurality of values of maximum segment identifier, SID, depths, each from one network element of the SDN system; identifying a path for one or more packets to transmit through a plurality of network elements, wherein a plurality of SIDs corresponding to the plurality of network elements is ordered to represent the path; splitting the path into a plurality of sub-paths based on the values of the maximum SID depths of the plurality of network elements, wherein each network element, for the path, is allocated to process a number of ordered SIDs, and wherein the number is within the network element's maximum SID depth; causing packet forwarding of the one or more packets along the plurality of sub-paths based on SIDs allocated to the network elements, the method being characterized in that: sending ordered SIDs of a first sub-path and a forwarding equivalence class to a selected network element in the first sub-path, wherein the selection is based on the ordered SIDs of the first sub-path; and sending, to a network element that is the last network element in a first sub-path and the first network element in a second sub-path, ordered SIDs of the second sub-path, and the same forwarding equivalence class that was sent to the selected network element in the first sub-path. receiving a plurality of values of maximum segment identifier, SID, depths, each from one network element of the SDN system; identifying a path for one or more packets to transmit through a plurality of network elements, wherein a plurality of SIDs corresponding to the plurality of network elements is ordered to represent the path; splitting the path into a plurality of sub-paths based on the values of the maximum SID depths of the plurality of network elements, wherein each network element, for the path, is allocated to process a number of ordered SIDs, and wherein the number is within the network element's maximum SID depth; causing packet forwarding of the one or more packets along the plurality of sub-paths based on SIDs allocated to the network elements, the method being characterized in that: sending ordered SIDs of a first sub-path and a forwarding equivalence class to a selected network element in the first sub-path, wherein the selection is based on the ordered SIDs of the first sub-path; and sending, to a network element that is the last network element in a first sub-path and the first network element in a second sub-path, ordered SIDs of the second sub-path, and the same forwarding equivalence class that was sent to the selected network element in the first sub-path. sending ordered SIDs of a first sub-path and a forwarding equivalence class to a selected network element in the first sub-path, wherein the selection is based on the ordered SIDs of the first sub-path; and sending, to a network element that is the last network element in a first sub-path and the first network element in a second sub-path, ordered SIDs of the second sub-path, and the same forwarding equivalence class that was sent to the selected network element in the first sub-path.