diff mbox

linux-generic: classification: add support for ODP_PMR_IPSEC_SPI

Message ID 1436875098-27302-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit aac78e18e53ab8be17020216921f5e5d14c8b26e
Headers show

Commit Message

Stuart Haslam July 14, 2015, 11:58 a.m. UTC
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/include/odp_classification_inlines.h | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Balasubramanian Manoharan July 15, 2015, 9:39 a.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

On 14 July 2015 at 17:28, Stuart Haslam <stuart.haslam@linaro.org> wrote:

> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
>  platform/linux-generic/include/odp_classification_inlines.h | 13
> ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp_classification_inlines.h
> b/platform/linux-generic/include/odp_classification_inlines.h
> index 8d1e1c1..560104e 100644
> --- a/platform/linux-generic/include/odp_classification_inlines.h
> +++ b/platform/linux-generic/include/odp_classification_inlines.h
> @@ -189,7 +189,18 @@ static inline int verify_pmr_ipsec_spi(uint8_t
> *pkt_addr ODP_UNUSED,
>                                        odp_packet_hdr_t *pkt_hdr
> ODP_UNUSED,
>                                        pmr_term_value_t *term_value
> ODP_UNUSED)
>  {
> -       ODP_UNIMPLEMENTED();
> +       uint32_t *spi;
> +
> +       if (!pkt_hdr->input_flags.ipsec)
> +               return 0;
> +
> +       spi = (uint32_t *)(pkt_addr + pkt_hdr->l4_offset);
> +       if (pkt_hdr->l4_protocol == ODPH_IPPROTO_AH)
> +               spi++;
> +
> +       if (term_value->val == (odp_be_to_cpu_32(*spi) & term_value->mask))
> +               return 1;
> +
>         return 0;
>  }
>  static inline int verify_pmr_ld_vni(uint8_t *pkt_addr ODP_UNUSED,
> --
> 2.1.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov July 16, 2015, 11:13 a.m. UTC | #2
Merged,
Maxim.

On 07/15/15 12:39, Bala Manoharan wrote:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org 
> <mailto:bala.manoharan@linaro.org>>
>
> On 14 July 2015 at 17:28, Stuart Haslam <stuart.haslam@linaro.org 
> <mailto:stuart.haslam@linaro.org>> wrote:
>
>     Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org
>     <mailto:stuart.haslam@linaro.org>>
>     ---
>      platform/linux-generic/include/odp_classification_inlines.h | 13
>     ++++++++++++-
>      1 file changed, 12 insertions(+), 1 deletion(-)
>
>     diff --git
>     a/platform/linux-generic/include/odp_classification_inlines.h
>     b/platform/linux-generic/include/odp_classification_inlines.h
>     index 8d1e1c1..560104e 100644
>     --- a/platform/linux-generic/include/odp_classification_inlines.h
>     +++ b/platform/linux-generic/include/odp_classification_inlines.h
>     @@ -189,7 +189,18 @@ static inline int
>     verify_pmr_ipsec_spi(uint8_t *pkt_addr ODP_UNUSED,
>                                            odp_packet_hdr_t *pkt_hdr
>     ODP_UNUSED,
>                                            pmr_term_value_t
>     *term_value ODP_UNUSED)
>      {
>     -       ODP_UNIMPLEMENTED();
>     +       uint32_t *spi;
>     +
>     +       if (!pkt_hdr->input_flags.ipsec)
>     +               return 0;
>     +
>     +       spi = (uint32_t *)(pkt_addr + pkt_hdr->l4_offset);
>     +       if (pkt_hdr->l4_protocol == ODPH_IPPROTO_AH)
>     +               spi++;
>     +
>     +       if (term_value->val == (odp_be_to_cpu_32(*spi) &
>     term_value->mask))
>     +               return 1;
>     +
>             return 0;
>      }
>      static inline int verify_pmr_ld_vni(uint8_t *pkt_addr ODP_UNUSED,
>     --
>     2.1.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h
index 8d1e1c1..560104e 100644
--- a/platform/linux-generic/include/odp_classification_inlines.h
+++ b/platform/linux-generic/include/odp_classification_inlines.h
@@ -189,7 +189,18 @@  static inline int verify_pmr_ipsec_spi(uint8_t *pkt_addr ODP_UNUSED,
 				       odp_packet_hdr_t *pkt_hdr ODP_UNUSED,
 				       pmr_term_value_t *term_value ODP_UNUSED)
 {
-	ODP_UNIMPLEMENTED();
+	uint32_t *spi;
+
+	if (!pkt_hdr->input_flags.ipsec)
+		return 0;
+
+	spi = (uint32_t *)(pkt_addr + pkt_hdr->l4_offset);
+	if (pkt_hdr->l4_protocol == ODPH_IPPROTO_AH)
+		spi++;
+
+	if (term_value->val == (odp_be_to_cpu_32(*spi) & term_value->mask))
+		return 1;
+
 	return 0;
 }
 static inline int verify_pmr_ld_vni(uint8_t *pkt_addr ODP_UNUSED,