A method performed by a user plane function, UPF, for handling pre-configured profiles for sets of detection and enforcement rules, wherein the UPF comprises one or more pre-configured profiles applicable to any user session, wherein each pre-configured profile comprises a set of detection and enforcement rules, wherein each pre-configured profile comprises a profile identity, ID, for identifying the pre-configured profile and the set of detection and enforcement rules for the pre-configured profile, the method comprising: sending (400, 500), to a control plane function, CPF,, information indicating that the user plane function supports pre-configuration of the one or more profiles for sets of detection and enforcement rules; receiving (401, 501), from the CPF, a first request for session establishment comprising at least one indication for profile activation for each pre-configured profile to be activated, wherein the at least one indication profile activation comprises the profile ID of the pre-configured profile to be activated; establishing (401, 502) the session indicated in the first request; and for the established session, activating (402, 503) the at least one pre-configured profile identified by the profile ID by instantiating the set of detection and enforcement rules for the pre-configured profile, wherein the pre-configured profile is a pre-configured Packet Detection Rule, PDR profile for a set of detection and enforcement rules being PDR, wherein each pre-configured PDR profile is associated with a profile precedence, and wherein the UPF comprises a rule precedence offset associated with each PDR in the set of detection and enforcement rules of the pre-configured PDR profile; and wherein the method further comprises: determining an instantiated precedence based on the profile precedence to the rule precedence offset, wherein each pre-configured PDR profile is assigned with the profile precedence, whereas each PDR in a particular PDR profile is assigned with an instantiated rule precedence, wherein the UPF comprises the rule precedence offset for each of the PDR in the pre-configured PDR profile, and determines the instantiated rule precedence for each PDR based on the profile precedence of the pre-configured PDR profile and the rule precedence offset of the respective PDR by summing of the profile precedence and the rule precedence offset, and wherein said instantiated rule precedence is a precedence of the instantiated PDR. sending (400, 500), to a control plane function, CPF,, information indicating that the user plane function supports pre-configuration of the one or more profiles for sets of detection and enforcement rules; receiving (401, 501), from the CPF, a first request for session establishment comprising at least one indication for profile activation for each pre-configured profile to be activated, wherein the at least one indication profile activation comprises the profile ID of the pre-configured profile to be activated; establishing (401, 502) the session indicated in the first request; and for the established session, activating (402, 503) the at least one pre-configured profile identified by the profile ID by instantiating the set of detection and enforcement rules for the pre-configured profile, wherein the pre-configured profile is a pre-configured Packet Detection Rule, PDR profile for a set of detection and enforcement rules being PDR, wherein each pre-configured PDR profile is associated with a profile precedence, and wherein the UPF comprises a rule precedence offset associated with each PDR in the set of detection and enforcement rules of the pre-configured PDR profile; and determining an instantiated precedence based on the profile precedence to the rule precedence offset, wherein each pre-configured PDR profile is assigned with the profile precedence, whereas each PDR in a particular PDR profile is assigned with an instantiated rule precedence, wherein the UPF comprises the rule precedence offset for each of the PDR in the pre-configured PDR profile, and determines the instantiated rule precedence for each PDR based on the profile precedence of the pre-configured PDR profile and the rule precedence offset of the respective PDR by summing of the profile precedence and the rule precedence offset, and wherein said instantiated rule precedence is a precedence of the instantiated PDR.