Message ID | 20180418151955.16206-1-yuval.shaia@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 2018/4/18 23:19, Yuval Shaia wrote: > It always returns 0. Change return type to void. > > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com> > --- > drivers/infiniband/sw/rxe/rxe.h | 2 +- > drivers/infiniband/sw/rxe/rxe_loc.h | 5 +++-- > drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++--- > drivers/infiniband/sw/rxe/rxe_recv.c | 5 ++--- > 4 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h > index 561ad307c6ec..1275fde6503a 100644 > --- a/drivers/infiniband/sw/rxe/rxe.h > +++ b/drivers/infiniband/sw/rxe/rxe.h > @@ -98,7 +98,7 @@ int rxe_add(struct rxe_dev *rxe, unsigned int mtu); > void rxe_remove(struct rxe_dev *rxe); > void rxe_remove_all(void); > > -int rxe_rcv(struct sk_buff *skb); > +void rxe_rcv(struct sk_buff *skb); > > static inline void rxe_dev_put(struct rxe_dev *rxe) > { > diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h > index b71023c1c58b..2f8ab8eebcb1 100644 > --- a/drivers/infiniband/sw/rxe/rxe_loc.h > +++ b/drivers/infiniband/sw/rxe/rxe_loc.h > @@ -143,7 +143,7 @@ void rxe_mem_cleanup(struct rxe_pool_entry *arg); > int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); > > /* rxe_net.c */ > -int rxe_loopback(struct sk_buff *skb); > +void rxe_loopback(struct sk_buff *skb); > int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb); > struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, > int paylen, struct rxe_pkt_info *pkt); > @@ -268,7 +268,8 @@ static inline int rxe_xmit_packet(struct rxe_dev *rxe, struct rxe_qp *qp, > > if (pkt->mask & RXE_LOOPBACK_MASK) { > memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt)); > - err = rxe_loopback(skb); > + rxe_loopback(skb); > + err = 0; > } else { > err = rxe_send(pkt, skb); > } > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > index 9da6e37fb70c..b43e9ed3f405 100644 > --- a/drivers/infiniband/sw/rxe/rxe_net.c > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > @@ -276,9 +276,10 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) > pkt->mask = RXE_GRH_MASK; > pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); > > - return rxe_rcv(skb); > + rxe_rcv(skb); > drop: > kfree_skb(skb); > + > return 0; > } > > @@ -517,9 +518,9 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) > return 0; > } > > -int rxe_loopback(struct sk_buff *skb) > +void rxe_loopback(struct sk_buff *skb) > { > - return rxe_rcv(skb); > + rxe_rcv(skb); > } > > static inline int addr_same(struct rxe_dev *rxe, struct rxe_av *av) > diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c > index dd80c7d9074a..d44b3da09585 100644 > --- a/drivers/infiniband/sw/rxe/rxe_recv.c > +++ b/drivers/infiniband/sw/rxe/rxe_recv.c > @@ -345,7 +345,7 @@ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb) > } > > /* rxe_rcv is called from the interface driver */ > -int rxe_rcv(struct sk_buff *skb) > +void rxe_rcv(struct sk_buff *skb) > { > int err; > struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); > @@ -403,12 +403,11 @@ int rxe_rcv(struct sk_buff *skb) > else > rxe_rcv_pkt(rxe, pkt, skb); > > - return 0; > + return; > > drop: > if (pkt->qp) > rxe_drop_ref(pkt->qp); > > kfree_skb(skb); > - return 0; > } -- 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
On 18/04/18 17:19, Yuval Shaia wrote: > It always returns 0. Change return type to void. > > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> > --- [...] > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > index 9da6e37fb70c..b43e9ed3f405 100644 > --- a/drivers/infiniband/sw/rxe/rxe_net.c > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > @@ -276,9 +276,10 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) > pkt->mask = RXE_GRH_MASK; > pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); > > - return rxe_rcv(skb); > + rxe_rcv(skb); > drop: > kfree_skb(skb); > + > return 0; > } Please correct me if I'm wrong but this is not quite the same. I've looked down the rxe_rcv() call chain and I don't think we should always call kfree_skb() unconditionally here. Byte, Johannes
On Thu, Apr 19, 2018 at 11:04:41AM +0200, Johannes Thumshirn wrote: > On 18/04/18 17:19, Yuval Shaia wrote: > > It always returns 0. Change return type to void. > > > > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> > > --- > > [...] > > > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > > index 9da6e37fb70c..b43e9ed3f405 100644 > > --- a/drivers/infiniband/sw/rxe/rxe_net.c > > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > > @@ -276,9 +276,10 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) > > pkt->mask = RXE_GRH_MASK; > > pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); > > > > - return rxe_rcv(skb); > > + rxe_rcv(skb); return 0; > > drop: > > kfree_skb(skb); > > + > > return 0; > > } > > Please correct me if I'm wrong but this is not quite the same. I've > looked down the rxe_rcv() call chain and I don't think we should always > call kfree_skb() unconditionally here. Right, i will add "return" after call to rxe_rcv, please see inline. > > Byte, > Johannes > > -- > Johannes Thumshirn Storage > jthumshirn@suse.de +49 911 74053 689 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: Felix Imendörffer, Jane Smithard, Graham Norton > HRB 21284 (AG Nürnberg) > Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 > -- > 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 -- 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
diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h index 561ad307c6ec..1275fde6503a 100644 --- a/drivers/infiniband/sw/rxe/rxe.h +++ b/drivers/infiniband/sw/rxe/rxe.h @@ -98,7 +98,7 @@ int rxe_add(struct rxe_dev *rxe, unsigned int mtu); void rxe_remove(struct rxe_dev *rxe); void rxe_remove_all(void); -int rxe_rcv(struct sk_buff *skb); +void rxe_rcv(struct sk_buff *skb); static inline void rxe_dev_put(struct rxe_dev *rxe) { diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h index b71023c1c58b..2f8ab8eebcb1 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -143,7 +143,7 @@ void rxe_mem_cleanup(struct rxe_pool_entry *arg); int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); /* rxe_net.c */ -int rxe_loopback(struct sk_buff *skb); +void rxe_loopback(struct sk_buff *skb); int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb); struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, int paylen, struct rxe_pkt_info *pkt); @@ -268,7 +268,8 @@ static inline int rxe_xmit_packet(struct rxe_dev *rxe, struct rxe_qp *qp, if (pkt->mask & RXE_LOOPBACK_MASK) { memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt)); - err = rxe_loopback(skb); + rxe_loopback(skb); + err = 0; } else { err = rxe_send(pkt, skb); } diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 9da6e37fb70c..b43e9ed3f405 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -276,9 +276,10 @@ static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) pkt->mask = RXE_GRH_MASK; pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); - return rxe_rcv(skb); + rxe_rcv(skb); drop: kfree_skb(skb); + return 0; } @@ -517,9 +518,9 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) return 0; } -int rxe_loopback(struct sk_buff *skb) +void rxe_loopback(struct sk_buff *skb) { - return rxe_rcv(skb); + rxe_rcv(skb); } static inline int addr_same(struct rxe_dev *rxe, struct rxe_av *av) diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index dd80c7d9074a..d44b3da09585 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c @@ -345,7 +345,7 @@ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb) } /* rxe_rcv is called from the interface driver */ -int rxe_rcv(struct sk_buff *skb) +void rxe_rcv(struct sk_buff *skb) { int err; struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); @@ -403,12 +403,11 @@ int rxe_rcv(struct sk_buff *skb) else rxe_rcv_pkt(rxe, pkt, skb); - return 0; + return; drop: if (pkt->qp) rxe_drop_ref(pkt->qp); kfree_skb(skb); - return 0; }
It always returns 0. Change return type to void. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> --- drivers/infiniband/sw/rxe/rxe.h | 2 +- drivers/infiniband/sw/rxe/rxe_loc.h | 5 +++-- drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++--- drivers/infiniband/sw/rxe/rxe_recv.c | 5 ++--- 4 files changed, 10 insertions(+), 9 deletions(-)