diff options
author | Zoltan Kiss <zoltan.kiss@citrix.com> | 2014-03-06 16:48:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-07 15:56:34 -0500 |
commit | 121fa4b77775549c3c5eb41eb335d7dcbb801f90 (patch) | |
tree | cac1ae8a3d4ac72411312d27090e0a9106b6586c /drivers/net/xen-netback/common.h | |
parent | 8f13dd9612286cc0d38d32ff9543763b7c74f6a5 (diff) |
xen-netback: Minor refactoring of netback code
This patch contains a few bits of refactoring before introducing the grant
mapping changes:
- introducing xenvif_tx_pending_slots_available(), as this is used several
times, and will be used more often
- rename the thread to vifX.Y-guest-rx, to signify it does RX work from the
guest point of view
Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/common.h')
-rw-r--r-- | drivers/net/xen-netback/common.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index ae413a2cbee7..9d3584545e5d 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -108,6 +108,15 @@ struct xenvif_rx_meta { | |||
108 | */ | 108 | */ |
109 | #define MAX_GRANT_COPY_OPS (MAX_SKB_FRAGS * XEN_NETIF_RX_RING_SIZE) | 109 | #define MAX_GRANT_COPY_OPS (MAX_SKB_FRAGS * XEN_NETIF_RX_RING_SIZE) |
110 | 110 | ||
111 | #define NETBACK_INVALID_HANDLE -1 | ||
112 | |||
113 | /* To avoid confusion, we define XEN_NETBK_LEGACY_SLOTS_MAX indicating | ||
114 | * the maximum slots a valid packet can use. Now this value is defined | ||
115 | * to be XEN_NETIF_NR_SLOTS_MIN, which is supposed to be supported by | ||
116 | * all backend. | ||
117 | */ | ||
118 | #define XEN_NETBK_LEGACY_SLOTS_MAX XEN_NETIF_NR_SLOTS_MIN | ||
119 | |||
111 | struct xenvif { | 120 | struct xenvif { |
112 | /* Unique identifier for this interface. */ | 121 | /* Unique identifier for this interface. */ |
113 | domid_t domid; | 122 | domid_t domid; |
@@ -216,7 +225,7 @@ void xenvif_carrier_off(struct xenvif *vif); | |||
216 | 225 | ||
217 | int xenvif_tx_action(struct xenvif *vif, int budget); | 226 | int xenvif_tx_action(struct xenvif *vif, int budget); |
218 | 227 | ||
219 | int xenvif_kthread(void *data); | 228 | int xenvif_kthread_guest_rx(void *data); |
220 | void xenvif_kick_thread(struct xenvif *vif); | 229 | void xenvif_kick_thread(struct xenvif *vif); |
221 | 230 | ||
222 | /* Determine whether the needed number of slots (req) are available, | 231 | /* Determine whether the needed number of slots (req) are available, |
@@ -226,6 +235,18 @@ bool xenvif_rx_ring_slots_available(struct xenvif *vif, int needed); | |||
226 | 235 | ||
227 | void xenvif_stop_queue(struct xenvif *vif); | 236 | void xenvif_stop_queue(struct xenvif *vif); |
228 | 237 | ||
238 | static inline pending_ring_idx_t nr_pending_reqs(struct xenvif *vif) | ||
239 | { | ||
240 | return MAX_PENDING_REQS - | ||
241 | vif->pending_prod + vif->pending_cons; | ||
242 | } | ||
243 | |||
244 | static inline bool xenvif_tx_pending_slots_available(struct xenvif *vif) | ||
245 | { | ||
246 | return nr_pending_reqs(vif) + XEN_NETBK_LEGACY_SLOTS_MAX | ||
247 | < MAX_PENDING_REQS; | ||
248 | } | ||
249 | |||
229 | extern bool separate_tx_rx_irq; | 250 | extern bool separate_tx_rx_irq; |
230 | 251 | ||
231 | #endif /* __XEN_NETBACK__COMMON_H__ */ | 252 | #endif /* __XEN_NETBACK__COMMON_H__ */ |