All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ethtool 1/2] ixgbe: missing "static" in function definition
@ 2014-04-03  3:06 Cristian Rodríguez
  2014-04-03  3:06 ` [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code Cristian Rodríguez
  2014-04-21 21:35 ` [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Ben Hutchings
  0 siblings, 2 replies; 5+ messages in thread
From: Cristian Rodríguez @ 2014-04-03  3:06 UTC (permalink / raw)
  To: netdev; +Cc: ben, Cristian Rodríguez

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
---
 ixgbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ixgbe.c b/ixgbe.c
index 6a663e4..3928d77 100644
--- a/ixgbe.c
+++ b/ixgbe.c
@@ -76,7 +76,7 @@ enum ixgbe_mac_type {
 	ixgbe_num_macs
 };
 
-enum ixgbe_mac_type
+static enum ixgbe_mac_type
 ixgbe_get_mac_type(u16 device_id)
 {
 	enum ixgbe_mac_type mac_type = ixgbe_mac_unknown;
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code
  2014-04-03  3:06 [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Cristian Rodríguez
@ 2014-04-03  3:06 ` Cristian Rodríguez
  2014-04-21 21:18   ` Ben Hutchings
  2014-04-21 21:18   ` Ben Hutchings
  2014-04-21 21:35 ` [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Ben Hutchings
  1 sibling, 2 replies; 5+ messages in thread
From: Cristian Rodríguez @ 2014-04-03  3:06 UTC (permalink / raw)
  To: netdev; +Cc: ben, Cristian Rodríguez

They are implemented in <endian.h> which is already included
in internal.h, no need to reinvent them with different names.

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
---
 ethtool.c  |  2 +-
 internal.h | 31 -------------------------------
 rxclass.c  |  4 ++--
 3 files changed, 3 insertions(+), 34 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index acb4397..e47ce0b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -368,7 +368,7 @@ static void parse_generic_cmdline(struct cmd_context *ctx,
 				}
 				case CMDL_BE16: {
 					u16 *p = info[idx].wanted_val;
-					*p = cpu_to_be16(
+					*p = htobe16(
 						get_uint_range(argp[i], 0,
 							       0xffff));
 					break;
diff --git a/internal.h b/internal.h
index 86a64f2..7e7266b 100644
--- a/internal.h
+++ b/internal.h
@@ -31,37 +31,6 @@ typedef __int32_t s32;
 #include "ethtool-copy.h"
 #include "net_tstamp-copy.h"
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-static inline u16 cpu_to_be16(u16 value)
-{
-	return value;
-}
-static inline u32 cpu_to_be32(u32 value)
-{
-	return value;
-}
-static inline u64 cpu_to_be64(u64 value)
-{
-	return value;
-}
-#else
-static inline u16 cpu_to_be16(u16 value)
-{
-	return (value >> 8) | (value << 8);
-}
-static inline u32 cpu_to_be32(u32 value)
-{
-	return cpu_to_be16(value >> 16) | (cpu_to_be16(value) << 16);
-}
-static inline u64 cpu_to_be64(u64 value)
-{
-	return cpu_to_be32(value >> 32) | ((u64)cpu_to_be32(value) << 32);
-}
-#endif
-
-#define ntohll cpu_to_be64
-#define htonll cpu_to_be64
-
 #define BITS_PER_BYTE		8
 #define BITS_PER_LONG		(BITS_PER_BYTE * sizeof(long))
 #define DIV_ROUND_UP(n, d)	(((n) + (d) - 1) / (d))
diff --git a/rxclass.c b/rxclass.c
index cd686a3..a013e06 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -836,7 +836,7 @@ static int rxclass_get_val(char *str, unsigned char *p, u32 *flags,
 		err = rxclass_get_ulong(str, &val, 64);
 		if (err)
 			return -1;
-		*(__be64 *)&p[opt->offset] = htonll((u64)val);
+		*(__be64 *)&p[opt->offset] = htobe64((u64)val);
 		if (opt->moffset >= 0)
 			*(__be64 *)&p[opt->moffset] = (__be64)mask;
 		break;
@@ -939,7 +939,7 @@ static int rxclass_get_mask(char *str, unsigned char *p,
 		err = rxclass_get_ulong(str, &val, 64);
 		if (err)
 			return -1;
-		*(__be64 *)&p[opt->moffset] = ~htonll((u64)val);
+		*(__be64 *)&p[opt->moffset] = ~htobe64((u64)val);
 		break;
 	}
 	case OPT_IP4: {
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code
  2014-04-03  3:06 ` [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code Cristian Rodríguez
@ 2014-04-21 21:18   ` Ben Hutchings
  2014-04-21 21:18   ` Ben Hutchings
  1 sibling, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2014-04-21 21:18 UTC (permalink / raw)
  To: Cristian Rodríguez; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

On Thu, 2014-04-03 at 00:06 -0300, Cristian Rodríguez wrote:
> They are implemented in <endian.h> which is already included
> in internal.h, no need to reinvent them with different names.
> 
> Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
[...]

According to the manual page, "These functions were added to glibc in
version 2.9."

Which is quite old now, but newer than several supported distributions
(e.g. RHEL 5).  So we would need an autoconf test and fallback
definition, at which point there doesn't seem to be any benefit.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code
  2014-04-03  3:06 ` [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code Cristian Rodríguez
  2014-04-21 21:18   ` Ben Hutchings
@ 2014-04-21 21:18   ` Ben Hutchings
  1 sibling, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2014-04-21 21:18 UTC (permalink / raw)
  To: Cristian Rodríguez; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

On Thu, 2014-04-03 at 00:06 -0300, Cristian Rodríguez wrote:
> They are implemented in <endian.h> which is already included
> in internal.h, no need to reinvent them with different names.
> 
> Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
[...]

According to the manual page, "These functions were added to glibc in
version 2.9."

Which is quite old now, but newer than several supported distributions
(e.g. RHEL 5).  So we would need an autoconf test and fallback
definition, at which point there doesn't seem to be any benefit.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ethtool 1/2] ixgbe: missing "static" in function definition
  2014-04-03  3:06 [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Cristian Rodríguez
  2014-04-03  3:06 ` [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code Cristian Rodríguez
@ 2014-04-21 21:35 ` Ben Hutchings
  1 sibling, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2014-04-21 21:35 UTC (permalink / raw)
  To: Cristian Rodríguez; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]

On Thu, 2014-04-03 at 00:06 -0300, Cristian Rodríguez wrote:
> Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
> ---
>  ixgbe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ixgbe.c b/ixgbe.c
> index 6a663e4..3928d77 100644
> --- a/ixgbe.c
> +++ b/ixgbe.c
> @@ -76,7 +76,7 @@ enum ixgbe_mac_type {
>  	ixgbe_num_macs
>  };
>  
> -enum ixgbe_mac_type
> +static enum ixgbe_mac_type
>  ixgbe_get_mac_type(u16 device_id)
>  {
>  	enum ixgbe_mac_type mac_type = ixgbe_mac_unknown;

Applied, thanks.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-21 21:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03  3:06 [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Cristian Rodríguez
2014-04-03  3:06 ` [PATCH ethtool 2/2] Use htobe64, htobe16 from libc instead of local byteswap code Cristian Rodríguez
2014-04-21 21:18   ` Ben Hutchings
2014-04-21 21:18   ` Ben Hutchings
2014-04-21 21:35 ` [PATCH ethtool 1/2] ixgbe: missing "static" in function definition Ben Hutchings

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.