Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-27 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

platform/linux-generic/odp_ipsec.c
@@ -1307,8 +1308,10 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ipsec_sa = _odp_ipsec_sa_use(sa);
ODP_ASSERT(NULL != ipsec_sa);
 
-   if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) ||
-   (!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK))
+   frag_mode = ipsec_sa->out.frag_mode;
+   if (opt->flag.frag_mode)
+   frag_mode = opt->frag_mode;
+   if (frag_mode == ODP_IPSEC_FRAG_CHECK)
mtu = ipsec_sa->out.mtu;
else
mtu = UINT32_MAX;


Comment:
No, it this code might be expanded to support other fragmentation modes.

> Dmitry Eremin-Solenikov(lumag) wrote:
> ack


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> No, because this code is implemented in the same way as the rest of 
>> `odp_packet_lX_type()` functions.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `return pkt_hdr->p.input_flags.eth ? ODP_PROTO_L2_TYPE_ETH : 
>>> ODP_PROTO_L2_TYPE_NONE;` might be simpler here.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
 simpler here.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might 
> be simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might 
>> be simpler here.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : 
>>> UINT32_MAX;` might be simpler here.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
 ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r171027141
updated_at 2018-02-27 18:50:40


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-27 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

platform/linux-generic/odp_packet.c
line 22
@@ -2506,6 +2506,16 @@ int odp_packet_has_ref(odp_packet_t pkt)
return 0;
 }
 
+odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt)
+{
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+   if (pkt_hdr->p.input_flags.eth)
+   return ODP_PROTO_L2_TYPE_ETH;
+
+   return ODP_PROTO_L2_TYPE_NONE;


Comment:
No, because this code is implemented in the same way as the rest of 
`odp_packet_lX_type()` functions.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `return pkt_hdr->p.input_flags.eth ? ODP_PROTO_L2_TYPE_ETH : 
> ODP_PROTO_L2_TYPE_NONE;` might be simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
>> simpler here.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
>>> simpler here.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
 simpler here.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : 
> UINT32_MAX;` might be simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
>> ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r171026780
updated_at 2018-02-27 18:49:38


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_ipsec.c
line 207
@@ -1307,8 +1308,10 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ipsec_sa = _odp_ipsec_sa_use(sa);
ODP_ASSERT(NULL != ipsec_sa);
 
-   if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) ||
-   (!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK))
+   frag_mode = ipsec_sa->out.frag_mode;
+   if (opt->flag.frag_mode)
+   frag_mode = opt->frag_mode;
+   if (frag_mode == ODP_IPSEC_FRAG_CHECK)
mtu = ipsec_sa->out.mtu;
else
mtu = UINT32_MAX;


Comment:
`mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : UINT32_MAX;` 
might be simpler here.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `frag_mode = opt->flag.frag_mode ? opt->frag_mode : ipsec_sa->out.frag_mode;` 
> might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r170779903
updated_at 2018-02-27 00:28:12


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_packet.c
line 22
@@ -2506,6 +2506,16 @@ int odp_packet_has_ref(odp_packet_t pkt)
return 0;
 }
 
+odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt)
+{
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+   if (pkt_hdr->p.input_flags.eth)
+   return ODP_PROTO_L2_TYPE_ETH;
+
+   return ODP_PROTO_L2_TYPE_NONE;


Comment:
`return pkt_hdr->p.input_flags.eth ? ODP_PROTO_L2_TYPE_ETH : 
ODP_PROTO_L2_TYPE_NONE;` might be simpler here.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
> simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
>> simpler here.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
>>> simpler here.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : 
 UINT32_MAX;` might be simpler here.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
> ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r170780739
updated_at 2018-02-27 00:28:12


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_ipsec.c
line 269
@@ -1697,7 +1702,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int 
num_in,
}
 
if (0 == param->num_opt)
-   opt = NULL;
+   opt = _out_opt;
else
opt = >opt[opt_idx];


Comment:
`opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
simpler here.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
> simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
>> simpler here.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : UINT32_MAX;` 
>>> might be simpler here.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
 ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r170780478
updated_at 2018-02-27 00:28:12


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_ipsec.c
line 269
@@ -1602,7 +1607,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int 
num_in,
ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa);
 
if (0 == param->num_opt)
-   opt = NULL;
+   opt = _out_opt;
else
opt = >opt[opt_idx];


Comment:
`opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
simpler here.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
> simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : UINT32_MAX;` 
>> might be simpler here.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
>>> ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r170780451
updated_at 2018-02-27 00:28:12


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_ipsec.c
line 269
@@ -1495,7 +1500,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in,
ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa);
 
if (0 == param->num_opt)
-   opt = NULL;
+   opt = _out_opt;
else
opt = >opt[opt_idx];


Comment:
`opt = param->num_opt ? >opt[opt_idx] : _opt_out;` might be 
simpler here.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `mtu = frag_mode == ODP_IPSEC_FRAG_CHECK ? ipsec_sa->out.mtu : UINT32_MAX;` 
> might be simpler here.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `frag_mode = opt->flag.frag_mode ? opt->frag_mode : 
>> ipsec_sa->out.frag_mode;` might be simpler here.


https://github.com/Linaro/odp/pull/502#discussion_r170780223
updated_at 2018-02-27 00:28:12


Re: [lng-odp] [PATCH API-NEXT v1] IPsec implementation update

2018-02-26 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_ipsec.c
line 203
@@ -1307,8 +1308,10 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ipsec_sa = _odp_ipsec_sa_use(sa);
ODP_ASSERT(NULL != ipsec_sa);
 
-   if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) ||
-   (!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK))
+   frag_mode = ipsec_sa->out.frag_mode;
+   if (opt->flag.frag_mode)
+   frag_mode = opt->frag_mode;


Comment:
`frag_mode = opt->flag.frag_mode ? opt->frag_mode : ipsec_sa->out.frag_mode;` 
might be simpler here.

https://github.com/Linaro/odp/pull/502#discussion_r170779617
updated_at 2018-02-27 00:28:12