From: Ben Pfaff Date: Thu, 5 Mar 2009 21:06:45 +0000 (-0800) Subject: dpif: Improve logging messages, to ease debugging. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae9ed6520e9e6b026629e83c341b3f6f0b6a0eb5;p=openvswitch dpif: Improve logging messages, to ease debugging. --- diff --git a/lib/dpif.c b/lib/dpif.c index fd7a8711..99337a31 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -236,7 +236,16 @@ dpif_port_add(struct dpif *dpif, const char *devname, uint16_t port_no) memset(&port, 0, sizeof port); strncpy(port.devname, devname, sizeof port.devname); port.port = port_no; - return IOCTL(dpif, ODP_PORT_ADD, &port); + if (!ioctl(dpif->fd, ODP_PORT_ADD, &port)) { + VLOG_DBG_RL(&dpmsg_rl, "dp%u: added %s as port %"PRIu16, + dpif->minor, devname, port_no); + return 0; + } else { + VLOG_WARN_RL(&error_rl, "dp%u: failed to add %s as port " + "%"PRIu16": %s", dpif->minor, devname, port_no, + strerror(errno)); + return errno; + } } int @@ -252,7 +261,15 @@ dpif_port_query_by_number(const struct dpif *dpif, uint16_t port_no, { memset(port, 0, sizeof *port); port->port = port_no; - return IOCTL(dpif, ODP_PORT_QUERY, port); + if (!ioctl(dpif->fd, ODP_PORT_QUERY, port)) { + VLOG_DBG_RL(&dpmsg_rl, "dp%u: port %"PRIu16" is device %s", + dpif->minor, port_no, port->devname); + return 0; + } else { + VLOG_WARN_RL(&error_rl, "dp%u: failed to query port %"PRIu16": %s", + dpif->minor, port_no, strerror(errno)); + return errno; + } } int @@ -261,7 +278,15 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname, { memset(port, 0, sizeof *port); strncpy(port->devname, devname, sizeof port->devname); - return IOCTL(dpif, ODP_PORT_QUERY, port); + if (!ioctl(dpif->fd, ODP_PORT_QUERY, port)) { + VLOG_DBG_RL(&dpmsg_rl, "dp%u: device %s is on port %"PRIu16, + dpif->minor, devname, port->port); + return 0; + } else { + VLOG_WARN_RL(&error_rl, "dp%u: failed to query port %s: %s", + dpif->minor, devname, strerror(errno)); + return errno; + } } int