Skip to content

Instantly share code, notes, and snippets.

@pavel-odintsov
Forked from majek/ixgbe-single-queue.diff
Last active March 27, 2019 07:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavel-odintsov/a877e9693954bc106557 to your computer and use it in GitHub Desktop.
Save pavel-odintsov/a877e9693954bc106557 to your computer and use it in GitHub Desktop.
diff -Nraup ixgbe-linux-netmap/ixgbe-3.23.2.1/src/ixgbe_main.c ixgbe-linux-netmap-single-queue/ixgbe-3.23.2.1/src/ixgbe_main.c
--- ixgbe-linux-netmap/ixgbe-3.23.2.1/src/ixgbe_main.c 2015-06-20 14:23:38.457783634 +0100
+++ ixgbe-linux-netmap-single-queue/ixgbe-3.23.2.1/src/ixgbe_main.c 2015-06-20 14:23:31.330496612 +0100
@@ -686,6 +686,7 @@ static bool ixgbe_clean_tx_irq(struct ix
if (test_bit(__IXGBE_DOWN, &adapter->state))
return true;
+ if (tx_ring->queue_index == 0) {
#ifdef DEV_NETMAP
/*
* In netmap mode, all the work is done in the context
@@ -693,10 +694,13 @@ static bool ixgbe_clean_tx_irq(struct ix
* clients, which may be sleeping on individual rings
* or on a global resource for all rings.
*/
-
+
+ printk(KERN_INFO "We call ixgbe_clean_tx_irq for queue %d\n", tx_ring->queue_index);
+
if (netmap_tx_irq(adapter->netdev, tx_ring->queue_index))
return 1; /* seems to be ignored */
#endif /* DEV_NETMAP */
+ }
tx_buffer = &tx_ring->tx_buffer_info[i];
tx_desc = IXGBE_TX_DESC(tx_ring, i);
@@ -2237,14 +2241,19 @@ static int ixgbe_clean_rx_irq(struct ixg
#endif /* CONFIG_FCOE */
u16 cleaned_count = ixgbe_desc_unused(rx_ring);
+ if (rx_ring->queue_index == 0) {
#ifdef DEV_NETMAP
/*
* Same as the txeof routine: only wakeup clients on intr.
*/
+
+ printk(KERN_INFO "We call ixgbe_clean_rx_irq for queue %d\n", rx_ring->queue_index);
+
int dummy;
if (netmap_rx_irq(rx_ring->netdev, rx_ring->queue_index, &dummy))
return true;
#endif /* DEV_NETMAP */
+ }
do {
union ixgbe_adv_rx_desc *rx_desc;
@@ -2365,14 +2374,18 @@ static int ixgbe_clean_rx_irq(struct ixg
u16 len = 0;
u16 cleaned_count = ixgbe_desc_unused(rx_ring);
+ if (rx_ring->queue_index == 0) {
#ifdef DEV_NETMAP
/*
* Same as the txeof routine: only wakeup clients on intr.
*/
+ printk(KERN_INFO "We call ixgbe_clean_rx_irq for queue %d\n", rx_ring->queue_index);
+
int dummy;
if (netmap_rx_irq(rx_ring->netdev, rx_ring->queue_index, &dummy))
return true;
#endif /* DEV_NETMAP */
+ }
do {
struct ixgbe_rx_buffer *rx_buffer;
@@ -3493,7 +3506,11 @@ void ixgbe_configure_tx_ring(struct ixgb
e_err(drv, "Could not enable Tx Queue %d\n", reg_idx);
#ifdef DEV_NETMAP
- ixgbe_netmap_configure_tx_ring(adapter, reg_idx);
+ if (reg_idx == 0) {
+ printk(KERN_INFO "We call ixgbe_netmap_configure_tx_ring for queue %d\n", reg_idx);
+
+ ixgbe_netmap_configure_tx_ring(adapter, reg_idx);
+ }
#endif /* DEV_NETMAP */
}
@@ -3955,8 +3972,12 @@ void ixgbe_configure_rx_ring(struct ixgb
ixgbe_rx_desc_queue_enable(adapter, ring);
#ifdef DEV_NETMAP
- if (ixgbe_netmap_configure_rx_ring(adapter, reg_idx))
+ if (reg_idx == 0) {
+ printk(KERN_INFO "We call ixgbe_netmap_configure_rx_ring for queue %d\n", reg_idx);
+
+ if (ixgbe_netmap_configure_rx_ring(adapter, reg_idx))
return;
+ }
#endif /* DEV_NETMAP */
ixgbe_alloc_rx_buffers(ring, ixgbe_desc_unused(ring));
@@ -5666,6 +5687,16 @@ static void ixgbe_up_complete(struct ixg
netif_tx_start_all_queues(adapter->netdev);
#ifdef DEV_NETMAP
+ printk(KERN_INFO "We call netmap_enable_all_rings\n");
+
+#define WNA(_ifp) (_ifp)->ax25_ptr
+#define NA(_ifp) ((struct netmap_adapter *)WNA(_ifp))
+
+struct netmap_adapter *na = NA(adapter->netdev);
+
+na->num_tx_rings = 1;
+na->num_rx_rings = 1;
+
netmap_enable_all_rings(adapter->netdev);
#endif
@@ -5943,6 +5974,16 @@ void ixgbe_down(struct ixgbe_adapter *ad
ixgbe_napi_disable_all(adapter);
#ifdef DEV_NETMAP
+ printk(KERN_INFO "We call netmap_disable_all_rings\n");
+
+#define WNA(_ifp) (_ifp)->ax25_ptr
+#define NA(_ifp) ((struct netmap_adapter *)WNA(_ifp))
+
+struct netmap_adapter *na = NA(adapter->netdev);
+
+na->num_tx_rings = 1;
+na->num_rx_rings = 1;
+
netmap_disable_all_rings(netdev);
#endif
@@ -9846,6 +9887,7 @@ no_info_string:
true);
#ifdef DEV_NETMAP
+ printk(KERN_INFO "We call ixgbe_netmap_attach\n");
// In modern patches this code located in the function end
ixgbe_netmap_attach(adapter);
#endif /* DEV_NETMAP */
@@ -9901,6 +9943,7 @@ static void __devexit ixgbe_remove(struc
https://github.com/luigirizzo/netmap/commit/b7aba79c54aa5ea0a7ec562b82170d8f2069d7de
for fixing this issue: https://github.com/luigirizzo/netmap/issues/54
*/
+ printk(KERN_INFO "We call netmap_detach\n");
netmap_detach(netdev);
#endif /* DEV_NETMAP */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment