[ovs-dev] [PATCH 5/9] netdev: Rename netdev_rx to netdev_rxq
Pravin
pshelar at nicira.com
Tue Mar 18 20:53:34 UTC 2014
Preparation for multi queue netdev IO.
Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
lib/dpif-netdev.c | 34 ++++++++++----------
lib/netdev-dummy.c | 84 ++++++++++++++++++++++++-------------------------
lib/netdev-linux.c | 66 +++++++++++++++++++-------------------
lib/netdev-provider.h | 34 ++++++++++----------
lib/netdev.c | 40 +++++++++++------------
lib/netdev.h | 24 +++++++-------
6 files changed, 141 insertions(+), 141 deletions(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 6467874..8ffbaa1 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -171,7 +171,7 @@ static struct dp_netdev_port *dp_netdev_lookup_port(const struct dp_netdev *dp,
/* A port in a netdev-based datapath. */
struct dp_netdev_port {
struct pkt_metadata md;
- struct netdev_rx *rx;
+ struct netdev_rxq *rxq;
struct netdev *netdev;
odp_port_t port_no;
struct netdev_saved_flags *sf;
@@ -666,7 +666,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
port->md = PKT_METADATA_INITIALIZER(port->port_no);
port->netdev = netdev;
port->type = xstrdup(type);
- error = netdev_rx_open(netdev, &port->rx);
+ error = netdev_rxq_open(netdev, &port->rxq);
if (error
&& !(error == EOPNOTSUPP && dpif_netdev_class_is_dummy(dp->class))) {
VLOG_ERR("%s: cannot receive packets on this network device (%s)",
@@ -677,9 +677,9 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
error = netdev_turn_flags_on(netdev, NETDEV_PROMISC, &sf);
if (error) {
- netdev_rx_close(port->rx);
+ netdev_rxq_close(port->rxq);
netdev_close(netdev);
- free(port->rx);
+ free(port->rxq);
free(port);
return error;
}
@@ -787,7 +787,7 @@ port_unref(struct dp_netdev_port *port)
{
if (port && ovs_refcount_unref(&port->ref_cnt) == 1) {
- netdev_rx_close(port->rx);
+ netdev_rxq_close(port->rxq);
netdev_restore_flags(port->sf);
netdev_close(port->netdev);
@@ -1624,15 +1624,15 @@ dp_netdev_actions_unref(struct dp_netdev_actions *actions)
}
inline static void
-dp_netdev_process_rx_port(struct dp_netdev *dp,
+dp_netdev_process_rxq_port(struct dp_netdev *dp,
struct dp_netdev_port *port,
- struct netdev_rx *queue)
+ struct netdev_rxq *queue)
{
struct ofpbuf *packet[MAX_RX_BATCH];
struct pkt_metadata *md = &port->md;
int error, c;
- error = netdev_rx_recv(queue, packet, &c);
+ error = netdev_rxq_recv(queue, packet, &c);
if (!error) {
int i;
@@ -1659,8 +1659,8 @@ dpif_netdev_run(struct dpif *dpif)
ovs_rwlock_rdlock(&dp->port_rwlock);
HMAP_FOR_EACH (port, node, &dp->ports) {
- if (port->rx && !netdev_is_pmd(port->netdev)) {
- dp_netdev_process_rx_port(dp, port, port->rx);
+ if (port->rxq && !netdev_is_pmd(port->netdev)) {
+ dp_netdev_process_rxq_port(dp, port, port->rxq);
}
}
@@ -1676,23 +1676,23 @@ dpif_netdev_wait(struct dpif *dpif)
ovs_rwlock_rdlock(&dp->port_rwlock);
HMAP_FOR_EACH (port, node, &dp->ports) {
- if (port->rx && !netdev_is_pmd(port->netdev)) {
- netdev_rx_wait(port->rx);
+ if (port->rxq && !netdev_is_pmd(port->netdev)) {
+ netdev_rxq_wait(port->rxq);
}
}
ovs_rwlock_unlock(&dp->port_rwlock);
}
-struct rx_poll {
+struct rxq_poll {
struct dp_netdev_port *port;
};
static int
pmd_load_queues(struct pmd_thread *f,
- struct rx_poll **ppoll_list, int poll_cnt)
+ struct rxq_poll **ppoll_list, int poll_cnt)
{
struct dp_netdev *dp = f->dp;
- struct rx_poll *poll_list = *ppoll_list;
+ struct rxq_poll *poll_list = *ppoll_list;
struct dp_netdev_port *port;
int id = f->id;
int index;
@@ -1744,7 +1744,7 @@ pmd_thread_main(void *f_)
struct pmd_thread *f = f_;
struct dp_netdev *dp = f->dp;
unsigned long lc = 0;
- struct rx_poll *poll_list;
+ struct rxq_poll *poll_list;
unsigned int port_seq;
int poll_cnt;
@@ -1762,7 +1762,7 @@ reload:
int i;
for (i = 0; i < poll_cnt; i++) {
- dp_netdev_process_rx_port(dp, poll_list[i].port, poll_list[i].port->rx);
+ dp_netdev_process_rxq_port(dp, poll_list[i].port, poll_list[i].port->rxq);
}
if (lc++ > (64 * 1024 * 1024)) {
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 7c73ca6..608bed8 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -100,16 +100,16 @@ struct netdev_dummy {
struct dummy_packet_conn conn OVS_GUARDED;
- FILE *tx_pcap, *rx_pcap OVS_GUARDED;
+ FILE *tx_pcap, *rxq_pcap OVS_GUARDED;
- struct list rxes OVS_GUARDED; /* List of child "netdev_rx_dummy"s. */
+ struct list rxes OVS_GUARDED; /* List of child "netdev_rxq_dummy"s. */
};
/* Max 'recv_queue_len' in struct netdev_dummy. */
#define NETDEV_DUMMY_MAX_QUEUE 100
-struct netdev_rx_dummy {
- struct netdev_rx up;
+struct netdev_rxq_dummy {
+ struct netdev_rxq up;
struct list node; /* In netdev_dummy's "rxes" list. */
struct list recv_queue;
int recv_queue_len; /* list_size(&recv_queue). */
@@ -135,11 +135,11 @@ netdev_dummy_cast(const struct netdev *netdev)
return CONTAINER_OF(netdev, struct netdev_dummy, up);
}
-static struct netdev_rx_dummy *
-netdev_rx_dummy_cast(const struct netdev_rx *rx)
+static struct netdev_rxq_dummy *
+netdev_rxq_dummy_cast(const struct netdev_rxq *rx)
{
ovs_assert(is_dummy_class(netdev_get_class(rx->netdev)));
- return CONTAINER_OF(rx, struct netdev_rx_dummy, up);
+ return CONTAINER_OF(rx, struct netdev_rxq_dummy, up);
}
static void
@@ -683,22 +683,22 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
dummy_packet_conn_set_config(&netdev->conn, args);
- if (netdev->rx_pcap) {
- fclose(netdev->rx_pcap);
+ if (netdev->rxq_pcap) {
+ fclose(netdev->rxq_pcap);
}
- if (netdev->tx_pcap && netdev->tx_pcap != netdev->rx_pcap) {
+ if (netdev->tx_pcap && netdev->tx_pcap != netdev->rxq_pcap) {
fclose(netdev->tx_pcap);
}
- netdev->rx_pcap = netdev->tx_pcap = NULL;
+ netdev->rxq_pcap = netdev->tx_pcap = NULL;
pcap = smap_get(args, "pcap");
if (pcap) {
- netdev->rx_pcap = netdev->tx_pcap = ovs_pcap_open(pcap, "ab");
+ netdev->rxq_pcap = netdev->tx_pcap = ovs_pcap_open(pcap, "ab");
} else {
- const char *rx_pcap = smap_get(args, "rx_pcap");
+ const char *rxq_pcap = smap_get(args, "rxq_pcap");
const char *tx_pcap = smap_get(args, "tx_pcap");
- if (rx_pcap) {
- netdev->rx_pcap = ovs_pcap_open(rx_pcap, "ab");
+ if (rxq_pcap) {
+ netdev->rxq_pcap = ovs_pcap_open(rxq_pcap, "ab");
}
if (tx_pcap) {
netdev->tx_pcap = ovs_pcap_open(tx_pcap, "ab");
@@ -710,17 +710,17 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
return 0;
}
-static struct netdev_rx *
-netdev_dummy_rx_alloc(void)
+static struct netdev_rxq *
+netdev_dummy_rxq_alloc(void)
{
- struct netdev_rx_dummy *rx = xzalloc(sizeof *rx);
+ struct netdev_rxq_dummy *rx = xzalloc(sizeof *rx);
return &rx->up;
}
static int
-netdev_dummy_rx_construct(struct netdev_rx *rx_)
+netdev_dummy_rxq_construct(struct netdev_rxq *rxq_)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev);
ovs_mutex_lock(&netdev->mutex);
@@ -734,9 +734,9 @@ netdev_dummy_rx_construct(struct netdev_rx *rx_)
}
static void
-netdev_dummy_rx_destruct(struct netdev_rx *rx_)
+netdev_dummy_rxq_destruct(struct netdev_rxq *rxq_)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev);
ovs_mutex_lock(&netdev->mutex);
@@ -747,17 +747,17 @@ netdev_dummy_rx_destruct(struct netdev_rx *rx_)
}
static void
-netdev_dummy_rx_dealloc(struct netdev_rx *rx_)
+netdev_dummy_rxq_dealloc(struct netdev_rxq *rxq_)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
free(rx);
}
static int
-netdev_dummy_rx_recv(struct netdev_rx *rx_, struct ofpbuf **arr, int *c)
+netdev_dummy_rxq_recv(struct netdev_rxq *rxq_, struct ofpbuf **arr, int *c)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev);
struct ofpbuf *packet;
@@ -785,9 +785,9 @@ netdev_dummy_rx_recv(struct netdev_rx *rx_, struct ofpbuf **arr, int *c)
}
static void
-netdev_dummy_rx_wait(struct netdev_rx *rx_)
+netdev_dummy_rxq_wait(struct netdev_rxq *rxq_)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev);
uint64_t seq = seq_read(rx->seq);
@@ -801,9 +801,9 @@ netdev_dummy_rx_wait(struct netdev_rx *rx_)
}
static int
-netdev_dummy_rx_drain(struct netdev_rx *rx_)
+netdev_dummy_rxq_drain(struct netdev_rxq *rxq_)
{
- struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ struct netdev_rxq_dummy *rx = netdev_rxq_dummy_cast(rxq_);
struct netdev_dummy *netdev = netdev_dummy_cast(rx->up.netdev);
ovs_mutex_lock(&netdev->mutex);
@@ -1045,13 +1045,13 @@ static const struct netdev_class dummy_class = {
netdev_dummy_update_flags,
- netdev_dummy_rx_alloc,
- netdev_dummy_rx_construct,
- netdev_dummy_rx_destruct,
- netdev_dummy_rx_dealloc,
- netdev_dummy_rx_recv,
- netdev_dummy_rx_wait,
- netdev_dummy_rx_drain,
+ netdev_dummy_rxq_alloc,
+ netdev_dummy_rxq_construct,
+ netdev_dummy_rxq_destruct,
+ netdev_dummy_rxq_dealloc,
+ netdev_dummy_rxq_recv,
+ netdev_dummy_rxq_wait,
+ netdev_dummy_rxq_drain,
};
static struct ofpbuf *
@@ -1095,7 +1095,7 @@ eth_from_packet_or_flow(const char *s)
}
static void
-netdev_dummy_queue_packet__(struct netdev_rx_dummy *rx, struct ofpbuf *packet)
+netdev_dummy_queue_packet__(struct netdev_rxq_dummy *rx, struct ofpbuf *packet)
{
list_push_back(&rx->recv_queue, &packet->list_node);
rx->recv_queue_len++;
@@ -1106,11 +1106,11 @@ static void
netdev_dummy_queue_packet(struct netdev_dummy *dummy, struct ofpbuf *packet)
OVS_REQUIRES(dummy->mutex)
{
- struct netdev_rx_dummy *rx, *prev;
+ struct netdev_rxq_dummy *rx, *prev;
- if (dummy->rx_pcap) {
- ovs_pcap_write(dummy->rx_pcap, packet);
- fflush(dummy->rx_pcap);
+ if (dummy->rxq_pcap) {
+ ovs_pcap_write(dummy->rxq_pcap, packet);
+ fflush(dummy->rxq_pcap);
}
prev = NULL;
LIST_FOR_EACH (rx, node, &dummy->rxes) {
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index a6e2217..6732366 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -424,8 +424,8 @@ struct netdev_linux {
int tap_fd;
};
-struct netdev_rx_linux {
- struct netdev_rx up;
+struct netdev_rxq_linux {
+ struct netdev_rxq up;
bool is_tap;
int fd;
};
@@ -484,11 +484,11 @@ netdev_linux_cast(const struct netdev *netdev)
return CONTAINER_OF(netdev, struct netdev_linux, up);
}
-static struct netdev_rx_linux *
-netdev_rx_linux_cast(const struct netdev_rx *rx)
+static struct netdev_rxq_linux *
+netdev_rxq_linux_cast(const struct netdev_rxq *rx)
{
ovs_assert(is_netdev_linux_class(netdev_get_class(rx->netdev)));
- return CONTAINER_OF(rx, struct netdev_rx_linux, up);
+ return CONTAINER_OF(rx, struct netdev_rxq_linux, up);
}
static void netdev_linux_update(struct netdev_linux *netdev,
@@ -773,17 +773,17 @@ netdev_linux_dealloc(struct netdev *netdev_)
free(netdev);
}
-static struct netdev_rx *
-netdev_linux_rx_alloc(void)
+static struct netdev_rxq *
+netdev_linux_rxq_alloc(void)
{
- struct netdev_rx_linux *rx = xzalloc(sizeof *rx);
+ struct netdev_rxq_linux *rx = xzalloc(sizeof *rx);
return &rx->up;
}
static int
-netdev_linux_rx_construct(struct netdev_rx *rx_)
+netdev_linux_rxq_construct(struct netdev_rxq *rxq_)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
struct netdev *netdev_ = rx->up.netdev;
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
int error;
@@ -869,9 +869,9 @@ error:
}
static void
-netdev_linux_rx_destruct(struct netdev_rx *rx_)
+netdev_linux_rxq_destruct(struct netdev_rxq *rxq_)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
if (!rx->is_tap) {
close(rx->fd);
@@ -879,9 +879,9 @@ netdev_linux_rx_destruct(struct netdev_rx *rx_)
}
static void
-netdev_linux_rx_dealloc(struct netdev_rx *rx_)
+netdev_linux_rxq_dealloc(struct netdev_rxq *rxq_)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
free(rx);
}
@@ -903,7 +903,7 @@ auxdata_has_vlan_tci(const struct tpacket_auxdata *aux)
}
static int
-netdev_linux_rx_recv_sock(int fd, struct ofpbuf *buffer)
+netdev_linux_rxq_recv_sock(int fd, struct ofpbuf *buffer)
{
size_t size;
ssize_t retval;
@@ -966,7 +966,7 @@ netdev_linux_rx_recv_sock(int fd, struct ofpbuf *buffer)
}
static int
-netdev_linux_rx_recv_tap(int fd, struct ofpbuf *buffer)
+netdev_linux_rxq_recv_tap(int fd, struct ofpbuf *buffer)
{
ssize_t retval;
size_t size = ofpbuf_tailroom(buffer);
@@ -986,9 +986,9 @@ netdev_linux_rx_recv_tap(int fd, struct ofpbuf *buffer)
}
static int
-netdev_linux_rx_recv(struct netdev_rx *rx_, struct ofpbuf **packet, int *c)
+netdev_linux_rxq_recv(struct netdev_rxq *rxq_, struct ofpbuf **packet, int *c)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
struct netdev *netdev = rx->up.netdev;
struct ofpbuf *buffer;
ssize_t retval;
@@ -1001,11 +1001,11 @@ netdev_linux_rx_recv(struct netdev_rx *rx_, struct ofpbuf **packet, int *c)
buffer = ofpbuf_new_with_headroom(VLAN_ETH_HEADER_LEN + mtu, DP_NETDEV_HEADROOM);
retval = (rx->is_tap
- ? netdev_linux_rx_recv_tap(rx->fd, buffer)
- : netdev_linux_rx_recv_sock(rx->fd, buffer));
+ ? netdev_linux_rxq_recv_tap(rx->fd, buffer)
+ : netdev_linux_rxq_recv_sock(rx->fd, buffer));
if (retval && retval != EAGAIN && retval != EMSGSIZE) {
VLOG_WARN_RL(&rl, "error receiving Ethernet packet on %s: %s",
- ovs_strerror(errno), netdev_rx_get_name(rx_));
+ ovs_strerror(errno), netdev_rxq_get_name(rxq_));
} else {
packet_set_size(buffer, buffer->size);
packet[0] = buffer;
@@ -1015,19 +1015,19 @@ netdev_linux_rx_recv(struct netdev_rx *rx_, struct ofpbuf **packet, int *c)
}
static void
-netdev_linux_rx_wait(struct netdev_rx *rx_)
+netdev_linux_rxq_wait(struct netdev_rxq *rxq_)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
poll_fd_wait(rx->fd, POLLIN);
}
static int
-netdev_linux_rx_drain(struct netdev_rx *rx_)
+netdev_linux_rxq_drain(struct netdev_rxq *rxq_)
{
- struct netdev_rx_linux *rx = netdev_rx_linux_cast(rx_);
+ struct netdev_rxq_linux *rx = netdev_rxq_linux_cast(rxq_);
if (rx->is_tap) {
struct ifreq ifr;
- int error = af_inet_ifreq_ioctl(netdev_rx_get_name(rx_), &ifr,
+ int error = af_inet_ifreq_ioctl(netdev_rxq_get_name(rxq_), &ifr,
SIOCGIFTXQLEN, "SIOCGIFTXQLEN");
if (error) {
return error;
@@ -2756,13 +2756,13 @@ netdev_linux_update_flags(struct netdev *netdev_, enum netdev_flags off,
\
netdev_linux_update_flags, \
\
- netdev_linux_rx_alloc, \
- netdev_linux_rx_construct, \
- netdev_linux_rx_destruct, \
- netdev_linux_rx_dealloc, \
- netdev_linux_rx_recv, \
- netdev_linux_rx_wait, \
- netdev_linux_rx_drain, \
+ netdev_linux_rxq_alloc, \
+ netdev_linux_rxq_construct, \
+ netdev_linux_rxq_destruct, \
+ netdev_linux_rxq_dealloc, \
+ netdev_linux_rxq_recv, \
+ netdev_linux_rxq_wait, \
+ netdev_linux_rxq_drain, \
}
const struct netdev_class netdev_linux_class =
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index 90700db..b60d2fb 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -56,12 +56,12 @@ void netdev_get_devices(const struct netdev_class *,
* Network device implementations may read these members but should not modify
* them.
*
- * None of these members change during the lifetime of a struct netdev_rx. */
-struct netdev_rx {
+ * None of these members change during the lifetime of a struct netdev_rxq. */
+struct netdev_rxq {
struct netdev *netdev; /* Owns a reference to the netdev. */
};
-struct netdev *netdev_rx_get_netdev(const struct netdev_rx *);
+struct netdev *netdev_rxq_get_netdev(const struct netdev_rxq *);
/* Network device class structure, to be defined by each implementation of a
* network device.
@@ -77,7 +77,7 @@ struct netdev *netdev_rx_get_netdev(const struct netdev_rx *);
*
* - "struct netdev", which represents a network device.
*
- * - "struct netdev_rx", which represents a handle for capturing packets
+ * - "struct netdev_rxq", which represents a handle for capturing packets
* received on a network device
*
* Each of these data structures contains all of the implementation-independent
@@ -99,7 +99,7 @@ struct netdev *netdev_rx_get_netdev(const struct netdev_rx *);
* "alloc" "construct" "destruct" "dealloc"
* ------------ ---------------- --------------- --------------
* netdev ->alloc ->construct ->destruct ->dealloc
- * netdev_rx ->rx_alloc ->rx_construct ->rx_destruct ->rx_dealloc
+ * netdev_rxq ->rxq_alloc ->rxq_construct ->rxq_destruct ->rxq_dealloc
*
* Any instance of a given data structure goes through the following life
* cycle:
@@ -620,19 +620,19 @@ struct netdev_class {
int (*update_flags)(struct netdev *netdev, enum netdev_flags off,
enum netdev_flags on, enum netdev_flags *old_flags);
-/* ## ------------------- ## */
-/* ## netdev_rx Functions ## */
-/* ## ------------------- ## */
+/* ## -------------------- ## */
+/* ## netdev_rxq Functions ## */
+/* ## -------------------- ## */
/* If a particular netdev class does not support receiving packets, all these
* function pointers must be NULL. */
- /* Life-cycle functions for a netdev_rx. See the large comment above on
+ /* Life-cycle functions for a netdev_rxq. See the large comment above on
* struct netdev_class. */
- struct netdev_rx *(*rx_alloc)(void);
- int (*rx_construct)(struct netdev_rx *);
- void (*rx_destruct)(struct netdev_rx *);
- void (*rx_dealloc)(struct netdev_rx *);
+ struct netdev_rxq *(*rxq_alloc)(void);
+ int (*rxq_construct)(struct netdev_rxq *);
+ void (*rxq_destruct)(struct netdev_rxq *);
+ void (*rxq_dealloc)(struct netdev_rxq *);
/* Attempts to receive batch of packets from 'rx' and place array of pointers
* into '*pkt'. netdev is responsible for allocating buffers.
@@ -641,15 +641,15 @@ struct netdev_class {
*
* This function may be set to null if it would always return EOPNOTSUPP
* anyhow. */
- int (*rx_recv)(struct netdev_rx *rx, struct ofpbuf **pkt, int *cnt);
+ int (*rxq_recv)(struct netdev_rxq *rx, struct ofpbuf **pkt, int *cnt);
/* Registers with the poll loop to wake up from the next call to
- * poll_block() when a packet is ready to be received with netdev_rx_recv()
+ * poll_block() when a packet is ready to be received with netdev_rxq_recv()
* on 'rx'. */
- void (*rx_wait)(struct netdev_rx *rx);
+ void (*rxq_wait)(struct netdev_rxq *rx);
/* Discards all packets waiting to be received from 'rx'. */
- int (*rx_drain)(struct netdev_rx *rx);
+ int (*rxq_drain)(struct netdev_rxq *rx);
};
int netdev_register_provider(const struct netdev_class *);
diff --git a/lib/netdev.c b/lib/netdev.c
index 058874f..3ba8308 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -506,24 +506,24 @@ netdev_parse_name(const char *netdev_name_, char **name, char **type)
}
}
-/* Attempts to open a netdev_rx handle for obtaining packets received on
- * 'netdev'. On success, returns 0 and stores a nonnull 'netdev_rx *' into
+/* Attempts to open a netdev_rxq handle for obtaining packets received on
+ * 'netdev'. On success, returns 0 and stores a nonnull 'netdev_rxq *' into
* '*rxp'. On failure, returns a positive errno value and stores NULL into
* '*rxp'.
*
* Some kinds of network devices might not support receiving packets. This
* function returns EOPNOTSUPP in that case.*/
int
-netdev_rx_open(struct netdev *netdev, struct netdev_rx **rxp)
+netdev_rxq_open(struct netdev *netdev, struct netdev_rxq **rxp)
OVS_EXCLUDED(netdev_mutex)
{
int error;
- if (netdev->netdev_class->rx_alloc) {
- struct netdev_rx *rx = netdev->netdev_class->rx_alloc();
+ if (netdev->netdev_class->rxq_alloc) {
+ struct netdev_rxq *rx = netdev->netdev_class->rxq_alloc();
if (rx) {
rx->netdev = netdev;
- error = netdev->netdev_class->rx_construct(rx);
+ error = netdev->netdev_class->rxq_construct(rx);
if (!error) {
ovs_mutex_lock(&netdev_mutex);
netdev->ref_cnt++;
@@ -532,7 +532,7 @@ netdev_rx_open(struct netdev *netdev, struct netdev_rx **rxp)
*rxp = rx;
return 0;
}
- netdev->netdev_class->rx_dealloc(rx);
+ netdev->netdev_class->rxq_dealloc(rx);
} else {
error = ENOMEM;
}
@@ -546,13 +546,13 @@ netdev_rx_open(struct netdev *netdev, struct netdev_rx **rxp)
/* Closes 'rx'. */
void
-netdev_rx_close(struct netdev_rx *rx)
+netdev_rxq_close(struct netdev_rxq *rx)
OVS_EXCLUDED(netdev_mutex)
{
if (rx) {
struct netdev *netdev = rx->netdev;
- netdev->netdev_class->rx_destruct(rx);
- netdev->netdev_class->rx_dealloc(rx);
+ netdev->netdev_class->rxq_destruct(rx);
+ netdev->netdev_class->rxq_dealloc(rx);
netdev_close(netdev);
}
}
@@ -575,11 +575,11 @@ netdev_rx_close(struct netdev_rx *rx)
* This function may be set to null if it would always return EOPNOTSUPP
* anyhow. */
int
-netdev_rx_recv(struct netdev_rx *rx, struct ofpbuf **buffers, int *cnt)
+netdev_rxq_recv(struct netdev_rxq *rx, struct ofpbuf **buffers, int *cnt)
{
int retval;
- retval = rx->netdev->netdev_class->rx_recv(rx, buffers, cnt);
+ retval = rx->netdev->netdev_class->rxq_recv(rx, buffers, cnt);
if (!retval) {
COVERAGE_INC(netdev_received);
}
@@ -589,17 +589,17 @@ netdev_rx_recv(struct netdev_rx *rx, struct ofpbuf **buffers, int *cnt)
/* Arranges for poll_block() to wake up when a packet is ready to be received
* on 'rx'. */
void
-netdev_rx_wait(struct netdev_rx *rx)
+netdev_rxq_wait(struct netdev_rxq *rx)
{
- rx->netdev->netdev_class->rx_wait(rx);
+ rx->netdev->netdev_class->rxq_wait(rx);
}
/* Discards any packets ready to be received on 'rx'. */
int
-netdev_rx_drain(struct netdev_rx *rx)
+netdev_rxq_drain(struct netdev_rxq *rx)
{
- return (rx->netdev->netdev_class->rx_drain
- ? rx->netdev->netdev_class->rx_drain(rx)
+ return (rx->netdev->netdev_class->rxq_drain
+ ? rx->netdev->netdev_class->rxq_drain(rx)
: 0);
}
@@ -1597,16 +1597,16 @@ netdev_get_type_from_name(const char *name)
}
struct netdev *
-netdev_rx_get_netdev(const struct netdev_rx *rx)
+netdev_rxq_get_netdev(const struct netdev_rxq *rx)
{
ovs_assert(rx->netdev->ref_cnt > 0);
return rx->netdev;
}
const char *
-netdev_rx_get_name(const struct netdev_rx *rx)
+netdev_rxq_get_name(const struct netdev_rxq *rx)
{
- return netdev_get_name(netdev_rx_get_netdev(rx));
+ return netdev_get_name(netdev_rxq_get_netdev(rx));
}
static void
diff --git a/lib/netdev.h b/lib/netdev.h
index 636bc8c..08c58ad 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -40,13 +40,13 @@ extern "C" {
* any number of threads on the same or different netdev objects. The
* exceptions are:
*
- * netdev_rx_recv()
- * netdev_rx_wait()
- * netdev_rx_drain()
+ * netdev_rxq_recv()
+ * netdev_rxq_wait()
+ * netdev_rxq_drain()
*
* These functions are conditionally thread-safe: they may be called from
- * different threads only on different netdev_rx objects. (The client may
- * create multiple netdev_rx objects for a single netdev and access each
+ * different threads only on different netdev_rxq objects. (The client may
+ * create multiple netdev_rxq objects for a single netdev and access each
* of those from a different thread.)
*
* NETDEV_FOR_EACH_QUEUE
@@ -61,7 +61,7 @@ extern "C" {
struct netdev;
struct netdev_class;
-struct netdev_rx;
+struct netdev_rxq;
struct netdev_saved_flags;
struct ofpbuf;
struct in_addr;
@@ -159,14 +159,14 @@ int netdev_set_mtu(const struct netdev *, int mtu);
int netdev_get_ifindex(const struct netdev *);
/* Packet reception. */
-int netdev_rx_open(struct netdev *, struct netdev_rx **);
-void netdev_rx_close(struct netdev_rx *);
+int netdev_rxq_open(struct netdev *, struct netdev_rxq **);
+void netdev_rxq_close(struct netdev_rxq *);
-const char *netdev_rx_get_name(const struct netdev_rx *);
+const char *netdev_rxq_get_name(const struct netdev_rxq *);
-int netdev_rx_recv(struct netdev_rx *rx, struct ofpbuf **buffers, int *cnt);
-void netdev_rx_wait(struct netdev_rx *);
-int netdev_rx_drain(struct netdev_rx *);
+int netdev_rxq_recv(struct netdev_rxq *rx, struct ofpbuf **buffers, int *cnt);
+void netdev_rxq_wait(struct netdev_rxq *);
+int netdev_rxq_drain(struct netdev_rxq *);
/* Packet transmission. */
int netdev_send(struct netdev *, struct ofpbuf *, bool may_steal);
--
1.7.9.5
More information about the dev
mailing list