On Wed, Sep 26, 2018 at 11:57:52AM -0500, Steve Wise wrote: > > > On 9/26/2018 11:53 AM, Leon Romanovsky wrote: > > On Wed, Sep 26, 2018 at 10:41:50AM -0500, Steve Wise wrote: > >> > >> On 9/26/2018 3:45 AM, Leon Romanovsky wrote: > >> > >>>> + if (!ndev) { > >>>> + pr_err("interface %s not found\n", ndev_name); > >>>> + err = -ENODEV; > >>>> + goto err; > >>>> + } > >>>> + > >>>> + if (net_to_rxe(ndev)) { > >>>> + pr_err("already configured on %s\n", ndev_name); > >>> Something general, not for this series, but we need to start to use > >>> extack to deliver errors and not dmesg. > >> extack is being used for the NEWLINK/DELLINK flow: > >> > >> rdma link add rxe_enp4s0f0 type rxe dev foo0 > >> link add: No such device > >> > >> nltrace snipit: > >> > >> netlink recv(3): > >> Setting msg proto to 20 > >> -------------------------- BEGIN NETLINK MESSAGE > >> --------------------------- > >> [NETLINK HEADER] 16 octets > >> .nlmsg_len = 76 > >> .type = 2 <ERROR> > >> .flags = 0 <> > >> .seq = 1537976444 > >> .port = 1718 > >> [ERRORMSG] 20 octets > >> .error = -19 "No such device" > >> [ORIGINAL MESSAGE] 16 octets > >> .nlmsg_len = 16 > >> .type = 5135 <0x140f> > >> .flags = 5 <REQUEST,ACK> > >> .seq = 1537976444 > >> .port = 0 > >> --------------------------- END NETLINK MESSAGE > >> --------------------------- > >> > > Ohh, great, can we return "already configured on .." error via extack > > and on not print it with pr_err()? > > I'm not sure yet how this works. I just see that if the nldev_newlink() > returns a negative errno, it ends up in this ERROR nlmsg and the error > string is automatically added. Still learning this stuff. :) See net/code/devlink.c code, they added support to return error messages through extack not too long ago. BTW, it is not related to this series, just general comment :) > >
Attachment:
signature.asc
Description: PGP signature