Inline reply On 07/01/2019 11:05, Zhao1, Wei wrote: > > >> -----Original Message----- >> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Julien Meunier >> Sent: Thursday, January 3, 2019 12:01 AM >> To: Ananyev, Konstantin <konstantin.anan...@intel.com>; Lu, Wenzhuo >> <wenzhuo...@intel.com> >> Cc: dev@dpdk.org >> Subject: [dpdk-dev] [PATCH] net/ixgbe: add support of loopback for >> X540/X550 >> >> Loopback mode is also supported on X540 and X550 NICs, according to their >> datasheet (section 15.2). The way to set it up is a little different of the >> 82599. >> >> Signed-off-by: Julien Meunier <julien.meun...@nokia.com> [...]
>> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c >> index 9a79d18..0ef7fdf 100644 >> --- a/drivers/net/ixgbe/ixgbe_rxtx.c >> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c [...] >> /* >> * Start Transmit and Receive Units. >> @@ -5148,10 +5175,16 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) >> rxctrl |= IXGBE_RXCTRL_RXEN; >> hw->mac.ops.enable_rx_dma(hw, rxctrl); >> >> - /* If loopback mode is enabled for 82599, set up the link accordingly >> */ >> - if (hw->mac.type == ixgbe_mac_82599EB && >> - dev->data->dev_conf.lpbk_mode == >> IXGBE_LPBK_82599_TX_RX) >> - ixgbe_setup_loopback_link_82599(hw); >> + /* If loopback mode is enabled, set up the link accordingly */ >> + if (dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_TX_RX) { >> + if (hw->mac.type == ixgbe_mac_82599EB) >> + ixgbe_setup_loopback_link_82599(hw); >> + else if (hw->mac.type == ixgbe_mac_X540 || >> + hw->mac.type == ixgbe_mac_X550 || >> + hw->mac.type == ixgbe_mac_X550EM_x || >> + hw->mac.type == ixgbe_mac_X550EM_a) >> + ixgbe_setup_loopback_link_x540_x550(hw); > Else > Return -1; > > SHOULD we add some branch here? > In case some other NIC with configuration for tx->rx loop but pmd code do not > support. My patch is iso-functional: if a user sets the lpbk_mode to 0x1 (IXGBE_LPBK_TX_RX), DPDK setups the TX -> RX loopback. Otherwise, it ignores the configuration. Please remember that lpbk_mode is specific to each PMD. in rte_ethdev.h: Loopback operation mode. By default the value is 0, meaning the loopback mode is disabled. Read the datasheet of given ethernet controller for details. The possible values of this field are defined in implementation of each driver. Other PMD can implement TX -> RX with other value. Do I need to add more check around this LPBK ? > >> + } > >> >> #ifdef RTE_LIBRTE_SECURITY >> if ((dev->data->dev_conf.rxmode.offloads & >> -- >> 2.10.2 > Thanks, Best regards, Julien Meunier