ethdev: allow to force Rx scatter mode
authorDavid Marchand <david.marchand@6wind.com>
Tue, 17 Jun 2014 18:09:29 +0000 (20:09 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 17 Jun 2014 22:55:05 +0000 (00:55 +0200)
We might want to be sure the scatter packets reception handler is selected in a
pmd. This makes it possible to then change mtu later, without the need of
restarting a port.
It is then the pmd duty to tell it enabled the scatter reception handler by
setting dev->data->scattered_rx to 1.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_ether/rte_ethdev.h
lib/librte_pmd_e1000/em_rxtx.c
lib/librte_pmd_e1000/igb_rxtx.c
lib/librte_pmd_ixgbe/ixgbe_rxtx.c

index 581259d..2b98700 100644 (file)
@@ -307,7 +307,8 @@ struct rte_eth_rxmode {
                hw_vlan_strip    : 1, /**< VLAN strip enable. */
                hw_vlan_extend   : 1, /**< Extended VLAN enable. */
                jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
-               hw_strip_crc     : 1; /**< Enable CRC stripping by hardware. */
+               hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
+               enable_scatter   : 1; /**< Enable scatter packets rx handler */
 };
 
 /**
index 1575e79..e5f1933 100644 (file)
@@ -1714,6 +1714,11 @@ eth_em_rx_init(struct rte_eth_dev *dev)
                }
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = eth_em_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        /*
         * Setup the Checksum Register.
         * Receive Full-Packet Checksum Offload is mutually exclusive with RSS.
index 9f0310d..aea898c 100644 (file)
@@ -2008,6 +2008,11 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
                E1000_WRITE_REG(hw, E1000_RXDCTL(rxq->reg_idx), rxdctl);
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        /*
         * Setup BSIZE field of RCTL register, if needed.
         * Buffer sizes >= 1024 are not [supposed to be] setup in the RCTL
@@ -2277,6 +2282,11 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev)
                E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        /*
         * Setup the HW Rx Head and Tail Descriptor Pointers.
         * This needs to be done after enable.
index ca72e75..f487859 100644 (file)
@@ -3486,6 +3486,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
                }
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        /*
         * Device configured with multiple RX queues.
         */
@@ -3961,6 +3966,11 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
                }
        }
 
+       if (dev->data->dev_conf.rxmode.enable_scatter) {
+               dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+               dev->data->scattered_rx = 1;
+       }
+
        return 0;
 }