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:
@@ -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 =
|
((struct ipa_ioc_add_rt_rule_ext_v2 *)header)->rules =
|
||||||
(u64)kptr;
|
(u64)kptr;
|
||||||
if (ipa3_add_rt_rule_ext_v2(
|
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");
|
IPAERR_RL("ipa3_add_rt_rule_ext_v2 fails\n");
|
||||||
retval = -EPERM;
|
retval = -EPERM;
|
||||||
goto free_param_kptr;
|
goto free_param_kptr;
|
||||||
|
@@ -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(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);
|
int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules);
|
||||||
|
|
||||||
|
@@ -1476,12 +1476,14 @@ bail:
|
|||||||
* ipa3_add_rt_rule_ext_v2() - Add the specified routing rules
|
* ipa3_add_rt_rule_ext_v2() - Add the specified routing rules
|
||||||
* to SW with rule id and optionally commit to IPA HW
|
* to SW with rule id and optionally commit to IPA HW
|
||||||
* @rules: [inout] set of routing rules to add
|
* @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
|
* Returns: 0 on success, negative on failure
|
||||||
*
|
*
|
||||||
* Note: Should not be called from atomic context
|
* 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 i;
|
||||||
int ret;
|
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 *)
|
&(((struct ipa_rt_rule_add_ext_i *)
|
||||||
rules->rules)[i].rt_rule_hdl),
|
rules->rules)[i].rt_rule_hdl),
|
||||||
((struct ipa_rt_rule_add_ext_i *)
|
((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);
|
IPAERR_RL("failed to add rt rule %d\n", i);
|
||||||
((struct ipa_rt_rule_add_ext_i *)
|
((struct ipa_rt_rule_add_ext_i *)
|
||||||
rules->rules)[i].status = IPA_RT_STATUS_OF_ADD_FAILED;
|
rules->rules)[i].status = IPA_RT_STATUS_OF_ADD_FAILED;
|
||||||
|
@@ -485,7 +485,8 @@ static int ipa3_setup_dflt_wan_rt_tables(void)
|
|||||||
(uint8_t)IPPROTO_ICMP;
|
(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");
|
IPAWANERR("fail to add dflt_wan v4 rule\n");
|
||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
goto free_rule_entry;
|
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 =
|
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v6.next_hdr =
|
||||||
(uint8_t)NEXTHDR_ICMP;
|
(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");
|
IPAWANERR("fail to add dflt_wan v6 rule\n");
|
||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
goto free_rule_entry;
|
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 =
|
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v4.protocol =
|
||||||
(uint8_t)IPPROTO_ICMP;
|
(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");
|
IPAWANERR("fail to add low lat v4 rule\n");
|
||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
goto free_rule_entry;
|
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;
|
IPA_FLT_META_DATA | IPA_FLT_NEXT_HDR;
|
||||||
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v6.next_hdr =
|
rt_rule_entry[WAN_RT_ICMP].rule.attrib.u.v6.next_hdr =
|
||||||
(uint8_t)IPPROTO_ICMP;
|
(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");
|
IPAWANERR("fail to add low lat v6 rule\n");
|
||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
goto free_rule_entry;
|
goto free_rule_entry;
|
||||||
|
Reference in New Issue
Block a user