msm: ipa: distingusih between userspace and kernel rt rule addition

Add changes to Distinguish between userspace and kernel
route rule addition.

Change-Id: Ieb53ea45e22907d48b47fb20f82e391dc036073f
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
This commit is contained in:
Michael Adisumarta
2021-07-29 16:18:19 -07:00
orang tua fd487e6278
melakukan 4eff4ff2e7
4 mengubah file dengan 15 tambahan dan 8 penghapusan

Melihat File

@@ -1448,7 +1448,7 @@ static int ipa3_ioctl_add_rt_rule_ext_v2(unsigned long arg)
((struct ipa_ioc_add_rt_rule_ext_v2 *)header)->rules =
(u64)kptr;
if (ipa3_add_rt_rule_ext_v2(
(struct ipa_ioc_add_rt_rule_ext_v2 *)header)) {
(struct ipa_ioc_add_rt_rule_ext_v2 *)header, true)) {
IPAERR_RL("ipa3_add_rt_rule_ext_v2 fails\n");
retval = -EPERM;
goto free_param_kptr;

Melihat File

@@ -2784,7 +2784,8 @@ int ipa3_add_rt_rule(struct ipa_ioc_add_rt_rule *rules);
int ipa3_add_rt_rule_ext(struct ipa_ioc_add_rt_rule_ext *rules);
int ipa3_add_rt_rule_ext_v2(struct ipa_ioc_add_rt_rule_ext_v2 *rules);
int ipa3_add_rt_rule_ext_v2(struct ipa_ioc_add_rt_rule_ext_v2 *rules,
bool user);
int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules);

Melihat File

@@ -1476,12 +1476,14 @@ bail:
* ipa3_add_rt_rule_ext_v2() - Add the specified routing rules
* to SW with rule id and optionally commit to IPA HW
* @rules: [inout] set of routing rules to add
* @user: [in] true if the rt rules are added from userspace
*
* Returns: 0 on success, negative on failure
*
* Note: Should not be called from atomic context
*/
int ipa3_add_rt_rule_ext_v2(struct ipa_ioc_add_rt_rule_ext_v2 *rules)
int ipa3_add_rt_rule_ext_v2(struct ipa_ioc_add_rt_rule_ext_v2 *rules,
bool user)
{
int i;
int ret;
@@ -1505,7 +1507,7 @@ int ipa3_add_rt_rule_ext_v2(struct ipa_ioc_add_rt_rule_ext_v2 *rules)
&(((struct ipa_rt_rule_add_ext_i *)
rules->rules)[i].rt_rule_hdl),
((struct ipa_rt_rule_add_ext_i *)
rules->rules)[i].rule_id, true)) {
rules->rules)[i].rule_id, user)) {
IPAERR_RL("failed to add rt rule %d\n", i);
((struct ipa_rt_rule_add_ext_i *)
rules->rules)[i].status = IPA_RT_STATUS_OF_ADD_FAILED;

Melihat File

@@ -485,7 +485,8 @@ static int ipa3_setup_dflt_wan_rt_tables(void)
(uint8_t)IPPROTO_ICMP;
}
if (ipa3_add_rt_rule_ext_v2(rt_rule)) {
if (ipa3_add_rt_rule_ext_v2(rt_rule,
false)) {
IPAWANERR("fail to add dflt_wan v4 rule\n");
ret = -EPERM;
goto free_rule_entry;
@@ -509,7 +510,8 @@ static int ipa3_setup_dflt_wan_rt_tables(void)
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v6.next_hdr =
(uint8_t)NEXTHDR_ICMP;
}
if (ipa3_add_rt_rule_ext_v2(rt_rule)) {
if (ipa3_add_rt_rule_ext_v2(rt_rule,
false)) {
IPAWANERR("fail to add dflt_wan v6 rule\n");
ret = -EPERM;
goto free_rule_entry;
@@ -596,7 +598,8 @@ static int ipa3_setup_low_lat_rt_rules(void)
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v4.protocol =
(uint8_t)IPPROTO_ICMP;
if (ipa3_add_rt_rule_ext_v2(rt_rule)) {
if (ipa3_add_rt_rule_ext_v2(rt_rule,
false)) {
IPAWANERR("fail to add low lat v4 rule\n");
ret = -EPERM;
goto free_rule_entry;
@@ -616,7 +619,8 @@ static int ipa3_setup_low_lat_rt_rules(void)
IPA_FLT_META_DATA | IPA_FLT_NEXT_HDR;
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v6.next_hdr =
(uint8_t)IPPROTO_ICMP;
if (ipa3_add_rt_rule_ext_v2(rt_rule)) {
if (ipa3_add_rt_rule_ext_v2(rt_rule,
false)) {
IPAWANERR("fail to add low lat v6 rule\n");
ret = -EPERM;
goto free_rule_entry;