}
}
-int
-dpif_get_name(struct dpif *dpif, char *name, size_t name_size)
-{
- struct odp_port port;
- int error;
-
- assert(name_size > 0);
- *name = '\0';
-
- error = dpif_port_query_by_number(dpif, ODPP_LOCAL, &port);
- if (!error) {
- ovs_strlcpy(name, port.devname, name_size);
- }
- return error;
-}
-
int
dpif_delete(struct dpif *dpif)
{
}
}
+int
+dpif_port_get_name(struct dpif *dpif, uint16_t port_no,
+ char *name, size_t name_size)
+{
+ struct odp_port port;
+ int error;
+
+ assert(name_size > 0);
+
+ error = dpif_port_query_by_number(dpif, port_no, &port);
+ if (!error) {
+ ovs_strlcpy(name, port.devname, name_size);
+ } else {
+ *name = '\0';
+ }
+ return error;
+}
+
int
dpif_port_list(const struct dpif *dpif,
struct odp_port **ports, size_t *n_ports)
if (error) {
goto error;
}
- error = dpif_get_name(&mon->dpif, local_name, sizeof local_name);
+ error = dpif_port_get_name(&mon->dpif, ODPP_LOCAL,
+ local_name, sizeof local_name);
if (error) {
goto error_close_dpif;
}
void dpif_close(struct dpif *);
static inline unsigned int dpif_id(const struct dpif *dpif);
-int dpif_get_name(struct dpif *, char *name, size_t name_size);
int dpif_delete(struct dpif *);
struct odp_port *);
int dpif_port_query_by_name(const struct dpif *, const char *devname,
struct odp_port *);
+int dpif_port_get_name(struct dpif *, uint16_t port_no,
+ char *name, size_t name_size);
int dpif_port_list(const struct dpif *, struct odp_port **, size_t *n_ports);
int dpif_port_group_set(struct dpif *, uint16_t group,
d->update_resolv_conf = update_resolv_conf;
/* Initialize DHCP client. */
- error = dpif_get_name(dpif, local_name, sizeof local_name);
+ error = dpif_port_get_name(dpif, ODPP_LOCAL,
+ local_name, sizeof local_name);
if (error) {
VLOG_ERR("failed to query datapath local port: %s", strerror(error));
goto error_regfree;
int error;
*in_bandp = NULL;
- error = dpif_get_name(dpif, local_name, sizeof local_name);
+ error = dpif_port_get_name(dpif, ODPP_LOCAL,
+ local_name, sizeof local_name);
if (error) {
return error;
}
uint8_t ea[ETH_ADDR_LEN];
int error;
- error = dpif_get_name(dpif, local_name, sizeof local_name);
+ error = dpif_port_get_name(dpif, ODPP_LOCAL,
+ local_name, sizeof local_name);
if (!error) {
error = netdev_nodev_get_etheraddr(local_name, ea);
if (!error) {
char *socket_name;
char *vconn_name;
- run(dpif_get_name(&dpif, dpif_name, sizeof dpif_name),
+ run(dpif_port_get_name(&dpif, ODPP_LOCAL, dpif_name, sizeof dpif_name),
"obtaining name of %s", dpif_name);
dpif_close(&dpif);
if (strcmp(dpif_name, name)) {
retval = dpif_open(devname, &dpif);
if (!retval) {
char dpif_name[IF_NAMESIZE];
- if (dpif_get_name(&dpif, dpif_name, sizeof dpif_name)
+ if (dpif_port_get_name(&dpif, ODPP_LOCAL,
+ dpif_name, sizeof dpif_name)
|| !cfg_has("bridge.%s.port", dpif_name)) {
dpif_delete(&dpif);
}