* [PATCH 1/3] infiniband: rxe: avoid 64-bit division
@ 2016-06-13 12:54 Arnd Bergmann
2016-06-13 12:54 ` [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-06-13 12:54 UTC (permalink / raw)
To: Leon Romanovsky
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann, Moni Shoua,
Doug Ledford, Sean Hefty, Hal Rosenstock, Amir Vadai, Kamal Heib,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
The rxe driver fails to build on 32-bit because of a 64-bit division:
In function `rxe_qp_from_attr':
:(.text+0x53158): undefined reference to `__aeabi_uldivmod'
We can easily avoid this division by converting the nanosecond value
into jiffies directly rather than converting to microseconds first.
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
drivers/infiniband/hw/rxe/rxe_qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/rxe/rxe_qp.c b/drivers/infiniband/hw/rxe/rxe_qp.c
index aa11ac3032b2..4e7b0985aab8 100644
--- a/drivers/infiniband/hw/rxe/rxe_qp.c
+++ b/drivers/infiniband/hw/rxe/rxe_qp.c
@@ -664,7 +664,7 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
qp->qp_timeout_jiffies = 0;
} else {
/* According to the spec, timeout = 4.096 * 2 ^ attr->timeout [us] */
- int j = usecs_to_jiffies((4096ULL << attr->timeout) / 1000);
+ int j = nsecs_to_jiffies(4096ULL << attr->timeout);
qp->qp_timeout_jiffies = j ? j : 1;
}
--
2.7.0
--
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 related [flat|nested] 7+ messages in thread* [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency 2016-06-13 12:54 [PATCH 1/3] infiniband: rxe: avoid 64-bit division Arnd Bergmann @ 2016-06-13 12:54 ` Arnd Bergmann [not found] ` <1465822509-4167617-2-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 2016-06-13 12:54 ` [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings Arnd Bergmann 2016-06-13 13:18 ` [PATCH 1/3] infiniband: rxe: avoid 64-bit division Leon Romanovsky 2 siblings, 1 reply; 7+ messages in thread From: Arnd Bergmann @ 2016-06-13 12:54 UTC (permalink / raw) To: Leon Romanovsky Cc: netdev, Arnd Bergmann, Moni Shoua, Doug Ledford, Sean Hefty, Hal Rosenstock, Amir Vadai, Haggai Eran, Kamal Heib, linux-rdma, linux-kernel The newly added rxe driver links against the UDP tunneling code, which causes build errors when CONFIG_UDP_TUNNEL is disabled: ERROR: "setup_udp_tunnel_sock" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! ERROR: "udp_tunnel_sock_release" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! ERROR: "udp_sock_create4" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! This adds a Kconfig dependency to prevent the invalid configuration. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/infiniband/hw/rxe/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/rxe/Kconfig b/drivers/infiniband/hw/rxe/Kconfig index 649b7be11eb8..a199d0df31d0 100644 --- a/drivers/infiniband/hw/rxe/Kconfig +++ b/drivers/infiniband/hw/rxe/Kconfig @@ -1,6 +1,7 @@ config INFINIBAND_RXE tristate "Software RDMA over Ethernet (RoCE) driver" depends on INET && PCI && INFINIBAND + depends on NET_UDP_TUNNEL ---help--- This driver implements the InfiniBand RDMA transport over the Linux network stack. It enables a system with a -- 2.7.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <1465822509-4167617-2-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>]
* Re: [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency [not found] ` <1465822509-4167617-2-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> @ 2016-06-13 15:28 ` Moni Shoua 0 siblings, 0 replies; 7+ messages in thread From: Moni Shoua @ 2016-06-13 15:28 UTC (permalink / raw) To: Arnd Bergmann Cc: Leon Romanovsky, netdev-u79uwXL29TY76Z2rM5mHXA, Doug Ledford, Sean Hefty, Hal Rosenstock, Amir Vadai, Haggai Eran, Kamal Heib, linux-rdma, linux-kernel-u79uwXL29TY76Z2rM5mHXA thanks. will be applied to next series On Mon, Jun 13, 2016 at 3:54 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote: > The newly added rxe driver links against the UDP tunneling code, > which causes build errors when CONFIG_UDP_TUNNEL is disabled: > > ERROR: "setup_udp_tunnel_sock" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! > ERROR: "udp_tunnel_sock_release" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! > ERROR: "udp_sock_create4" [drivers/infiniband/hw/rxe/ib_rxe.ko] undefined! > > This adds a Kconfig dependency to prevent the invalid configuration. > > Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> > --- > drivers/infiniband/hw/rxe/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/hw/rxe/Kconfig b/drivers/infiniband/hw/rxe/Kconfig > index 649b7be11eb8..a199d0df31d0 100644 > --- a/drivers/infiniband/hw/rxe/Kconfig > +++ b/drivers/infiniband/hw/rxe/Kconfig > @@ -1,6 +1,7 @@ > config INFINIBAND_RXE > tristate "Software RDMA over Ethernet (RoCE) driver" > depends on INET && PCI && INFINIBAND > + depends on NET_UDP_TUNNEL > ---help--- > This driver implements the InfiniBand RDMA transport over > the Linux network stack. It enables a system with a > -- > 2.7.0 > > -- > 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 -- 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] 7+ messages in thread
* [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings 2016-06-13 12:54 [PATCH 1/3] infiniband: rxe: avoid 64-bit division Arnd Bergmann 2016-06-13 12:54 ` [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency Arnd Bergmann @ 2016-06-13 12:54 ` Arnd Bergmann [not found] ` <1465822509-4167617-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> 2016-06-13 13:18 ` [PATCH 1/3] infiniband: rxe: avoid 64-bit division Leon Romanovsky 2 siblings, 1 reply; 7+ messages in thread From: Arnd Bergmann @ 2016-06-13 12:54 UTC (permalink / raw) To: Leon Romanovsky Cc: netdev, Arnd Bergmann, Moni Shoua, Doug Ledford, Sean Hefty, Hal Rosenstock, Kamal Heib, Haggai Eran, linux-rdma, linux-kernel The new rxe infinband driver passes around pointers that have been converted to 64-bit integers. This is valid, but causes compile-time warnings on all 32-bit architectures: infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_single': infiniband/hw/rxe/rxe_dma.c:49:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] return (u64)cpu_addr; ^ infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_page': infiniband/hw/rxe/rxe_dma.c:73:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] infiniband/hw/rxe/rxe_dma.c: In function 'rxe_map_sg': infiniband/hw/rxe/rxe_dma.c:99:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_alloc_coherent': infiniband/hw/rxe/rxe_dma.c:143:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] This changes the cast to use 'uintptr_t', which can always be cast to and from pointer, and can be assigned to and from 64-bit integers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/infiniband/hw/rxe/rxe_dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/rxe/rxe_dma.c b/drivers/infiniband/hw/rxe/rxe_dma.c index f080bc5bda43..7634c1a81b2b 100644 --- a/drivers/infiniband/hw/rxe/rxe_dma.c +++ b/drivers/infiniband/hw/rxe/rxe_dma.c @@ -46,7 +46,7 @@ static u64 rxe_dma_map_single(struct ib_device *dev, enum dma_data_direction direction) { WARN_ON(!valid_dma_direction(direction)); - return (u64)cpu_addr; + return (uintptr_t)cpu_addr; } static void rxe_dma_unmap_single(struct ib_device *dev, @@ -70,7 +70,7 @@ static u64 rxe_dma_map_page(struct ib_device *dev, goto done; } - addr = (u64)page_address(page); + addr = (uintptr_t)page_address(page); if (addr) addr += offset; @@ -96,7 +96,7 @@ static int rxe_map_sg(struct ib_device *dev, struct scatterlist *sgl, WARN_ON(!valid_dma_direction(direction)); for_each_sg(sgl, sg, nents, i) { - addr = (u64)page_address(sg_page(sg)); + addr = (uintptr_t)page_address(sg_page(sg)); if (!addr) { ret = 0; break; @@ -140,7 +140,7 @@ static void *rxe_dma_alloc_coherent(struct ib_device *dev, size_t size, addr = page_address(p); if (dma_handle) - *dma_handle = (u64)addr; + *dma_handle = (uintptr_t)addr; return addr; } -- 2.7.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <1465822509-4167617-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>]
* Re: [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings [not found] ` <1465822509-4167617-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org> @ 2016-06-13 15:29 ` Moni Shoua 0 siblings, 0 replies; 7+ messages in thread From: Moni Shoua @ 2016-06-13 15:29 UTC (permalink / raw) To: Arnd Bergmann Cc: Leon Romanovsky, netdev-u79uwXL29TY76Z2rM5mHXA, Doug Ledford, Sean Hefty, Hal Rosenstock, Kamal Heib, Haggai Eran, linux-rdma, linux-kernel-u79uwXL29TY76Z2rM5mHXA thanks. will be applied to next series. On Mon, Jun 13, 2016 at 3:54 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote: > The new rxe infinband driver passes around pointers that have been > converted to 64-bit integers. This is valid, but causes compile-time > warnings on all 32-bit architectures: > > infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_single': > infiniband/hw/rxe/rxe_dma.c:49:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > return (u64)cpu_addr; > ^ > infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_page': > infiniband/hw/rxe/rxe_dma.c:73:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > infiniband/hw/rxe/rxe_dma.c: In function 'rxe_map_sg': > infiniband/hw/rxe/rxe_dma.c:99:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_alloc_coherent': > infiniband/hw/rxe/rxe_dma.c:143:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > > This changes the cast to use 'uintptr_t', which can always be > cast to and from pointer, and can be assigned to and from 64-bit > integers. > > Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> > --- > drivers/infiniband/hw/rxe/rxe_dma.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/hw/rxe/rxe_dma.c b/drivers/infiniband/hw/rxe/rxe_dma.c > index f080bc5bda43..7634c1a81b2b 100644 > --- a/drivers/infiniband/hw/rxe/rxe_dma.c > +++ b/drivers/infiniband/hw/rxe/rxe_dma.c > @@ -46,7 +46,7 @@ static u64 rxe_dma_map_single(struct ib_device *dev, > enum dma_data_direction direction) > { > WARN_ON(!valid_dma_direction(direction)); > - return (u64)cpu_addr; > + return (uintptr_t)cpu_addr; > } > > static void rxe_dma_unmap_single(struct ib_device *dev, > @@ -70,7 +70,7 @@ static u64 rxe_dma_map_page(struct ib_device *dev, > goto done; > } > > - addr = (u64)page_address(page); > + addr = (uintptr_t)page_address(page); > if (addr) > addr += offset; > > @@ -96,7 +96,7 @@ static int rxe_map_sg(struct ib_device *dev, struct scatterlist *sgl, > WARN_ON(!valid_dma_direction(direction)); > > for_each_sg(sgl, sg, nents, i) { > - addr = (u64)page_address(sg_page(sg)); > + addr = (uintptr_t)page_address(sg_page(sg)); > if (!addr) { > ret = 0; > break; > @@ -140,7 +140,7 @@ static void *rxe_dma_alloc_coherent(struct ib_device *dev, size_t size, > addr = page_address(p); > > if (dma_handle) > - *dma_handle = (u64)addr; > + *dma_handle = (uintptr_t)addr; > > return addr; > } > -- > 2.7.0 > > -- > 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 -- 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] 7+ messages in thread
* Re: [PATCH 1/3] infiniband: rxe: avoid 64-bit division 2016-06-13 12:54 [PATCH 1/3] infiniband: rxe: avoid 64-bit division Arnd Bergmann 2016-06-13 12:54 ` [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency Arnd Bergmann 2016-06-13 12:54 ` [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings Arnd Bergmann @ 2016-06-13 13:18 ` Leon Romanovsky [not found] ` <20160613131840.GJ5408-2ukJVAZIZ/Y@public.gmane.org> 2 siblings, 1 reply; 7+ messages in thread From: Leon Romanovsky @ 2016-06-13 13:18 UTC (permalink / raw) To: Arnd Bergmann Cc: netdev, Moni Shoua, Doug Ledford, Sean Hefty, Hal Rosenstock, Amir Vadai, Kamal Heib, linux-rdma, linux-kernel [-- Attachment #1: Type: text/plain, Size: 503 bytes --] On Mon, Jun 13, 2016 at 02:54:53PM +0200, Arnd Bergmann wrote: > The rxe driver fails to build on 32-bit because of a 64-bit division: > > In function `rxe_qp_from_attr': > :(.text+0x53158): undefined reference to `__aeabi_uldivmod' > > We can easily avoid this division by converting the nanosecond value > into jiffies directly rather than converting to microseconds first. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Thanks Arnd, All three patches are applied on topic/rxe now. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20160613131840.GJ5408-2ukJVAZIZ/Y@public.gmane.org>]
* Re: [PATCH 1/3] infiniband: rxe: avoid 64-bit division [not found] ` <20160613131840.GJ5408-2ukJVAZIZ/Y@public.gmane.org> @ 2016-06-13 15:27 ` Moni Shoua 0 siblings, 0 replies; 7+ messages in thread From: Moni Shoua @ 2016-06-13 15:27 UTC (permalink / raw) To: Leon Romanovsky Cc: Arnd Bergmann, netdev-u79uwXL29TY76Z2rM5mHXA, Doug Ledford, Sean Hefty, Hal Rosenstock, Amir Vadai, Kamal Heib, linux-rdma, linux-kernel-u79uwXL29TY76Z2rM5mHXA thanks. will be applied to next series On Mon, Jun 13, 2016 at 4:18 PM, Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > On Mon, Jun 13, 2016 at 02:54:53PM +0200, Arnd Bergmann wrote: >> The rxe driver fails to build on 32-bit because of a 64-bit division: >> >> In function `rxe_qp_from_attr': >> :(.text+0x53158): undefined reference to `__aeabi_uldivmod' >> >> We can easily avoid this division by converting the nanosecond value >> into jiffies directly rather than converting to microseconds first. >> >> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> > > Thanks Arnd, > All three patches are applied on topic/rxe now. -- 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] 7+ messages in thread
end of thread, other threads:[~2016-06-13 15:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 12:54 [PATCH 1/3] infiniband: rxe: avoid 64-bit division Arnd Bergmann
2016-06-13 12:54 ` [PATCH 2/3] infiniband: rxe: add UDP_TUNNEL dependency Arnd Bergmann
[not found] ` <1465822509-4167617-2-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2016-06-13 15:28 ` Moni Shoua
2016-06-13 12:54 ` [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings Arnd Bergmann
[not found] ` <1465822509-4167617-3-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2016-06-13 15:29 ` Moni Shoua
2016-06-13 13:18 ` [PATCH 1/3] infiniband: rxe: avoid 64-bit division Leon Romanovsky
[not found] ` <20160613131840.GJ5408-2ukJVAZIZ/Y@public.gmane.org>
2016-06-13 15:27 ` Moni Shoua
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).