Message ID | 1469736146-17640-1-git-send-email-shiraz.saleem@intel.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Thu, Jul 28, 2016 at 03:02:26PM -0500, Shiraz Saleem wrote: > From: Mustafa Ismail <mustafa.ismail@intel.com> > > During connection establishment with a large number of > connections, it is possible that the connection requests > might fail. Adding flow control prevents this failure. > Change ibnl_unicast to use blocking to enable flow control. > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > Signed-off-by: Faisal Latif <faisal.latif@intel.com> > Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> > --- > > V3: update to use blocking ver. of netlink_unicast() in > ibnl_unicast(), instead of creating new function in > netlink header for this purpose; as was done in V1. > > V2: update commit message with justification for flow control. > CC'ing linux-netdev mailing list. > > drivers/infiniband/core/netlink.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c > index 9b8c20c..a6b3acb 100644 > --- a/drivers/infiniband/core/netlink.c > +++ b/drivers/infiniband/core/netlink.c > @@ -229,7 +229,13 @@ static void ibnl_rcv(struct sk_buff *skb) > int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, > __u32 pid) > { > - return nlmsg_unicast(nls, skb, pid); > + int err; > + > + err = netlink_unicast(nls, skb, pid, 0); > + if (err > 0) > + err = 0; > + > + return err; It can be simplified a little bit to remove number of lines. 4 last lines can be replaced to be one in ANSI C. return (err < 0)?:0;
On Fri, 2016-07-29 at 07:47 +0300, Leon Romanovsky wrote: > On Thu, Jul 28, 2016 at 03:02:26PM -0500, Shiraz Saleem wrote: > > > > From: Mustafa Ismail <mustafa.ismail@intel.com> > > > > During connection establishment with a large number of > > connections, it is possible that the connection requests > > might fail. Adding flow control prevents this failure. > > Change ibnl_unicast to use blocking to enable flow control. > > > > Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> > > Signed-off-by: Faisal Latif <faisal.latif@intel.com> > > Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> > > --- > > > > V3: update to use blocking ver. of netlink_unicast() in > > ibnl_unicast(), instead of creating new function in > > netlink header for this purpose; as was done in V1. > > > > V2: update commit message with justification for flow control. > > CC'ing linux-netdev mailing list. > > > > drivers/infiniband/core/netlink.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/infiniband/core/netlink.c > > b/drivers/infiniband/core/netlink.c > > index 9b8c20c..a6b3acb 100644 > > --- a/drivers/infiniband/core/netlink.c > > +++ b/drivers/infiniband/core/netlink.c > > @@ -229,7 +229,13 @@ static void ibnl_rcv(struct sk_buff *skb) > > int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, > > __u32 pid) > > { > > - return nlmsg_unicast(nls, skb, pid); > > + int err; > > + > > + err = netlink_unicast(nls, skb, pid, 0); > > + if (err > 0) > > + err = 0; > > + > > + return err; > > It can be simplified a little bit to remove number of lines. > 4 last lines can be replaced to be one in ANSI C. > > return (err < 0)?:0; return (err < 0) ? err : 0; is more readable to me. With fixup and minor change to commit subject, applied.
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index 9b8c20c..a6b3acb 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c @@ -229,7 +229,13 @@ static void ibnl_rcv(struct sk_buff *skb) int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh, __u32 pid) { - return nlmsg_unicast(nls, skb, pid); + int err; + + err = netlink_unicast(nls, skb, pid, 0); + if (err > 0) + err = 0; + + return err; } EXPORT_SYMBOL(ibnl_unicast); @@ -252,6 +258,7 @@ int __init ibnl_init(void) return -ENOMEM; } + nls->sk_sndtimeo = 10 * HZ; return 0; }