Message ID | 1467965654-34734-1-git-send-email-forrest.shi@linaro.org |
---|---|
State | New |
Headers | show |
Ping. Review is needed. This patch series has to be for master branch. Especially this bug fix patch. Maxim. On 07/08/16 11:14, forrest.shi@linaro.org wrote: > From: Xuelin Shi <forrest.shi@linaro.org> > > The prototype says returning cpu endian value but implementation returns > a little-endian value. > > Add conversion to cpu endian. > > Signed-off-by: Xuelin Shi <forrest.shi@linaro.org> > --- > helper/ip.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/helper/ip.c b/helper/ip.c > index eb73e5a..e211001 100644 > --- a/helper/ip.c > +++ b/helper/ip.c > @@ -12,6 +12,7 @@ > int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) > { > unsigned byte[ODPH_IPV4ADDR_LEN]; > + uint32_t ipaddr_le; > int i; > > memset(byte, 0, sizeof(byte)); > @@ -24,7 +25,8 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) > if (byte[i] > 255) > return -1; > > - *ip_addr = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; > + ipaddr_le = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; > + *ip_addr = odp_le_to_cpu_32(ipaddr_le); > > return 0; > }
Hi Maxim, Let's see if any comments first, then I will send it to master again. Thanks, Forrest On 11 July 2016 at 21:08, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Ping. Review is needed. > > This patch series has to be for master branch. Especially this bug fix > patch. > > Maxim. > > > > > On 07/08/16 11:14, forrest.shi@linaro.org wrote: > >> From: Xuelin Shi <forrest.shi@linaro.org> >> >> The prototype says returning cpu endian value but implementation returns >> a little-endian value. >> >> Add conversion to cpu endian. >> >> Signed-off-by: Xuelin Shi <forrest.shi@linaro.org> >> --- >> helper/ip.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/helper/ip.c b/helper/ip.c >> index eb73e5a..e211001 100644 >> --- a/helper/ip.c >> +++ b/helper/ip.c >> @@ -12,6 +12,7 @@ >> int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) >> { >> unsigned byte[ODPH_IPV4ADDR_LEN]; >> + uint32_t ipaddr_le; >> int i; >> memset(byte, 0, sizeof(byte)); >> @@ -24,7 +25,8 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char >> *str) >> if (byte[i] > 255) >> return -1; >> - *ip_addr = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; >> + ipaddr_le = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | >> byte[3]; >> + *ip_addr = odp_le_to_cpu_32(ipaddr_le); >> return 0; >> } >> > >
Hello all, Any comments or objections for these 3 patches. Thanks, Forrest > -----Original Message----- > From: forrest.shi@linaro.org [mailto:forrest.shi@linaro.org] > Sent: Friday, July 08, 2016 16:14 > To: bill.fischofer@linaro.org > Cc: lng-odp@lists.linaro.org; Xuelin Shi <forrest.shi@linaro.org> > Subject: [lng-odp][PATCH/API-NEXT 1/3] helper/ip: fix ip parsing endian issue > > From: Xuelin Shi <forrest.shi@linaro.org> > > The prototype says returning cpu endian value but implementation returns a > little-endian value. > > Add conversion to cpu endian. > > Signed-off-by: Xuelin Shi <forrest.shi@linaro.org> > --- > helper/ip.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/helper/ip.c b/helper/ip.c > index eb73e5a..e211001 100644 > --- a/helper/ip.c > +++ b/helper/ip.c > @@ -12,6 +12,7 @@ > int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) { > unsigned byte[ODPH_IPV4ADDR_LEN]; > + uint32_t ipaddr_le; > int i; > > memset(byte, 0, sizeof(byte)); > @@ -24,7 +25,8 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char > *str) > if (byte[i] > 255) > return -1; > > - *ip_addr = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; > + ipaddr_le = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; > + *ip_addr = odp_le_to_cpu_32(ipaddr_le); > > return 0; > } > -- > 2.1.0.27.g96db324
diff --git a/helper/ip.c b/helper/ip.c index eb73e5a..e211001 100644 --- a/helper/ip.c +++ b/helper/ip.c @@ -12,6 +12,7 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) { unsigned byte[ODPH_IPV4ADDR_LEN]; + uint32_t ipaddr_le; int i; memset(byte, 0, sizeof(byte)); @@ -24,7 +25,8 @@ int odph_ipv4_addr_parse(uint32_t *ip_addr, const char *str) if (byte[i] > 255) return -1; - *ip_addr = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; + ipaddr_le = byte[0] << 24 | byte[1] << 16 | byte[2] << 8 | byte[3]; + *ip_addr = odp_le_to_cpu_32(ipaddr_le); return 0; }