Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1697512
| From | Yuval Shaia <yuval.shaia@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] drivers/rxe: improve rxe loopback |
| Date | 2017-07-26 21:40 +0200 |
| Message-ID | <u7Ak2-4uD-15@gated-at.bofh.it> (permalink) |
| References | <u7vX4-1Cp-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jul 26, 2017 at 05:52:48PM +0300, Marcel Apfelbaum wrote:
> Currently a packet is marked for loopback only if the source and
> destination address match. This is not enough when multiple
> gids are present in rxe's gid table and the traffic is
> from one gid to another.
>
> Fix it by marking the packet for loopback if the destination
> address appears in rxe's gid table.
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> drivers/infiniband/sw/rxe/rxe_net.c | 47 +++++++++++++++++++++++++++++++++++--
> 1 file changed, 45 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index c3a140e..b76a9a3 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -351,6 +351,27 @@ static void prepare_ipv6_hdr(struct dst_entry *dst, struct sk_buff *skb,
> ip6h->payload_len = htons(skb->len - sizeof(*ip6h));
> }
>
> +static inline bool addr4_same_rxe(struct rxe_dev *rxe, struct in_addr *daddr)
> +{
> + struct in_device *in_dev;
> + bool same_rxe = false;
> +
> + rcu_read_lock();
> + in_dev = __in_dev_get_rcu(rxe->ndev);
> + if (!in_dev)
> + goto out;
> +
> + for_ifa(in_dev)
> + if (!memcmp(&ifa->ifa_address, daddr, sizeof(*daddr))) {
> + same_rxe = true;
> + goto out;
> + }
> + endfor_ifa(in_dev);
The above endfor_ifa should move to below.
> +out:
> + rcu_read_unlock();
> + return same_rxe;
> +}
> +
> static int prepare4(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
> struct sk_buff *skb, struct rxe_av *av)
> {
> @@ -367,7 +388,7 @@ static int prepare4(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
> return -EHOSTUNREACH;
> }
>
> - if (!memcmp(saddr, daddr, sizeof(*daddr)))
> + if (addr4_same_rxe(rxe, daddr))
> pkt->mask |= RXE_LOOPBACK_MASK;
>
> prepare_udp_hdr(skb, htons(RXE_ROCE_V2_SPORT),
> @@ -384,6 +405,28 @@ static int prepare4(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
> return 0;
> }
>
> +static inline bool addr6_same_rxe(struct rxe_dev *rxe, struct in6_addr *daddr)
> +{
> + struct inet6_dev *in6_dev;
> + struct inet6_ifaddr *ifp;
> + bool same_rxe = false;
> +
> + in6_dev = in6_dev_get(rxe->ndev);
> + if (!in6_dev)
> + return false;
> +
> + read_lock_bh(&in6_dev->lock);
> + list_for_each_entry(ifp, &in6_dev->addr_list, if_list)
> + if (!memcmp(&ifp->addr, daddr, sizeof(*daddr))) {
> + same_rxe = true;
> + goto out;
> + }
> +out:
> + read_unlock_bh(&in6_dev->lock);
> + in6_dev_put(in6_dev);
> + return same_rxe;
> +}
> +
> static int prepare6(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
> struct sk_buff *skb, struct rxe_av *av)
> {
> @@ -398,7 +441,7 @@ static int prepare6(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
> return -EHOSTUNREACH;
> }
>
> - if (!memcmp(saddr, daddr, sizeof(*daddr)))
> + if (addr6_same_rxe(rxe, daddr))
> pkt->mask |= RXE_LOOPBACK_MASK;
>
> prepare_udp_hdr(skb, htons(RXE_ROCE_V2_SPORT),
> --
> 2.9.4
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] drivers/rxe: improve rxe loopback Marcel Apfelbaum <marcel@redhat.com> - 2017-07-26 17:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Yuval Shaia <yuval.shaia@oracle.com> - 2017-07-26 21:40 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Yuval Shaia <yuval.shaia@oracle.com> - 2017-07-26 22:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Yuval Shaia <yuval.shaia@oracle.com> - 2017-07-26 22:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Moni Shoua <monis@mellanox.com> - 2017-07-27 09:10 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Marcel Apfelbaum <marcel@redhat.com> - 2017-07-27 12:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Moni Shoua <monis@mellanox.com> - 2017-07-30 12:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Marcel Apfelbaum <marcel@redhat.com> - 2017-07-31 12:00 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Leon Romanovsky <leon@kernel.org> - 2017-07-27 09:40 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Marcel Apfelbaum <marcel@redhat.com> - 2017-07-27 11:50 +0200
Re: [PATCH] drivers/rxe: improve rxe loopback Leon Romanovsky <leon@kernel.org> - 2017-07-27 12:50 +0200
csiph-web