All of lore.kernel.org
 help / color / mirror / Atom feed
* [ofa-general] [PATCH] mlx4: confiugre cache line size
@ 2009-09-16 11:03 Eli Cohen
  2009-09-22 17:51 ` Roland Dreier
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Cohen @ 2009-09-16 11:03 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma, general-list

ConnectX can work more efficiently if the CPU cache line size is confiugred to
it at INIT_HCA. This patch configures cache line size for systems that report
it.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
---
 drivers/net/mlx4/fw.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index 20526ce..aa38c06 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -699,6 +699,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
 #define INIT_HCA_IN_SIZE		 0x200
 #define INIT_HCA_VERSION_OFFSET		 0x000
 #define	 INIT_HCA_VERSION		 2
+#define INIT_HCA_CACHELINE_SZ_OFFSET	 0x0e
 #define INIT_HCA_FLAGS_OFFSET		 0x014
 #define INIT_HCA_QPC_OFFSET		 0x020
 #define	 INIT_HCA_QPC_BASE_OFFSET	 (INIT_HCA_QPC_OFFSET + 0x10)
@@ -736,6 +737,12 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param)
 
 	*((u8 *) mailbox->buf + INIT_HCA_VERSION_OFFSET) = INIT_HCA_VERSION;
 
+#if defined(cache_line_size)
+	*((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) =
+		order_base_2(cache_line_size() / 16) << 5;
+#endif
+
+
 #if defined(__LITTLE_ENDIAN)
 	*(inbox + INIT_HCA_FLAGS_OFFSET / 4) &= ~cpu_to_be32(1 << 1);
 #elif defined(__BIG_ENDIAN)
-- 
1.6.4.3

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

* Re: [PATCH] mlx4: confiugre cache line size
  2009-09-16 11:03 [ofa-general] [PATCH] mlx4: confiugre cache line size Eli Cohen
@ 2009-09-22 17:51 ` Roland Dreier
  2009-09-22 18:54   ` [ofa-general] " Eli Cohen
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Dreier @ 2009-09-22 17:51 UTC (permalink / raw)
  To: Eli Cohen; +Cc: general-list, linux-rdma-u79uwXL29TY76Z2rM5mHXA


 > +#if defined(cache_line_size)

Why the #if here?  Do we just need to include <linux/cache.h> explicitly
to make sure we get the define?

 > +	*((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) =
 > +		order_base_2(cache_line_size() / 16) << 5;

Trivial but I think it's safe to assume a cacheline is always a power of
2.  And I think it's clearer (and avoids generating a divide) to use
subtraction rather than division... so this could all become:

		(ilog2(cache_line_size()) - 4) << 5;

 - R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [ofa-general] Re: [PATCH] mlx4: confiugre cache line size
  2009-09-22 17:51 ` Roland Dreier
@ 2009-09-22 18:54   ` Eli Cohen
  2009-09-22 23:15     ` Roland Dreier
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Cohen @ 2009-09-22 18:54 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma, Eli Cohen, general-list

On Tue, Sep 22, 2009 at 10:51:10AM -0700, Roland Dreier wrote:
I agree with you on both comments. Would you like me to resend or will
you make the necessary changes?

> 
>  > +#if defined(cache_line_size)
> 
> Why the #if here?  Do we just need to include <linux/cache.h> explicitly
> to make sure we get the define?
> 
>  > +	*((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) =
>  > +		order_base_2(cache_line_size() / 16) << 5;
> 
> Trivial but I think it's safe to assume a cacheline is always a power of
> 2.  And I think it's clearer (and avoids generating a divide) to use
> subtraction rather than division... so this could all become:
> 
> 		(ilog2(cache_line_size()) - 4) << 5;
> 
>  - R.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [ofa-general] Re: [PATCH] mlx4: confiugre cache line size
  2009-09-22 18:54   ` [ofa-general] " Eli Cohen
@ 2009-09-22 23:15     ` Roland Dreier
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Dreier @ 2009-09-22 23:15 UTC (permalink / raw)
  To: Eli Cohen; +Cc: linux-rdma, Eli Cohen, general-list


 > I agree with you on both comments. Would you like me to resend or will
 > you make the necessary changes?

please resend, thanks.

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

end of thread, other threads:[~2009-09-22 23:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 11:03 [ofa-general] [PATCH] mlx4: confiugre cache line size Eli Cohen
2009-09-22 17:51 ` Roland Dreier
2009-09-22 18:54   ` [ofa-general] " Eli Cohen
2009-09-22 23:15     ` Roland Dreier

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.