Commit 09a50880 authored by Mengyuan Lou's avatar Mengyuan Lou Committed by David S. Miller

net: libwx: Add tx path to process packets

Support to transmit packets without hardware features.
Signed-off-by: default avatarMengyuan Lou <mengyuanlou@net-swift.com>
Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c47e8ae
...@@ -1355,6 +1355,10 @@ static void wx_configure_tx_ring(struct wx *wx, ...@@ -1355,6 +1355,10 @@ static void wx_configure_tx_ring(struct wx *wx,
txdctl |= ring->count / 128 << WX_PX_TR_CFG_TR_SIZE_SHIFT; txdctl |= ring->count / 128 << WX_PX_TR_CFG_TR_SIZE_SHIFT;
txdctl |= 0x20 << WX_PX_TR_CFG_WTHRESH_SHIFT; txdctl |= 0x20 << WX_PX_TR_CFG_WTHRESH_SHIFT;
/* reinitialize tx_buffer_info */
memset(ring->tx_buffer_info, 0,
sizeof(struct wx_tx_buffer) * ring->count);
/* enable queue */ /* enable queue */
wr32(wx, WX_PX_TR_CFG(reg_idx), txdctl); wr32(wx, WX_PX_TR_CFG(reg_idx), txdctl);
......
This diff is collapsed.
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
void wx_alloc_rx_buffers(struct wx_ring *rx_ring, u16 cleaned_count); void wx_alloc_rx_buffers(struct wx_ring *rx_ring, u16 cleaned_count);
u16 wx_desc_unused(struct wx_ring *ring); u16 wx_desc_unused(struct wx_ring *ring);
netdev_tx_t wx_xmit_frame(struct sk_buff *skb,
struct net_device *netdev);
void wx_napi_enable_all(struct wx *wx); void wx_napi_enable_all(struct wx *wx);
void wx_napi_disable_all(struct wx *wx); void wx_napi_disable_all(struct wx *wx);
void wx_reset_interrupt_capability(struct wx *wx); void wx_reset_interrupt_capability(struct wx *wx);
...@@ -21,6 +23,7 @@ void wx_free_isb_resources(struct wx *wx); ...@@ -21,6 +23,7 @@ void wx_free_isb_resources(struct wx *wx);
u32 wx_misc_isb(struct wx *wx, enum wx_isb_idx idx); u32 wx_misc_isb(struct wx *wx, enum wx_isb_idx idx);
void wx_configure_vectors(struct wx *wx); void wx_configure_vectors(struct wx *wx);
void wx_clean_all_rx_rings(struct wx *wx); void wx_clean_all_rx_rings(struct wx *wx);
void wx_clean_all_tx_rings(struct wx *wx);
void wx_free_resources(struct wx *wx); void wx_free_resources(struct wx *wx);
int wx_setup_resources(struct wx *wx); int wx_setup_resources(struct wx *wx);
void wx_get_stats64(struct net_device *netdev, void wx_get_stats64(struct net_device *netdev,
......
...@@ -312,6 +312,15 @@ ...@@ -312,6 +312,15 @@
#endif #endif
#define WX_RX_BUFFER_WRITE 16 /* Must be power of 2 */ #define WX_RX_BUFFER_WRITE 16 /* Must be power of 2 */
#define WX_MAX_DATA_PER_TXD BIT(14)
/* Tx Descriptors needed, worst case */
#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), WX_MAX_DATA_PER_TXD)
#define DESC_NEEDED (MAX_SKB_FRAGS + 4)
/* Ether Types */
#define WX_ETH_P_CNM 0x22E7
#define WX_CFG_PORT_ST 0x14404 #define WX_CFG_PORT_ST 0x14404
/******************* Receive Descriptor bit definitions **********************/ /******************* Receive Descriptor bit definitions **********************/
...@@ -320,6 +329,14 @@ ...@@ -320,6 +329,14 @@
#define WX_RXD_ERR_RXE BIT(29) /* Any MAC Error */ #define WX_RXD_ERR_RXE BIT(29) /* Any MAC Error */
/*********************** Transmit Descriptor Config Masks ****************/
#define WX_TXD_STAT_DD BIT(0) /* Descriptor Done */
#define WX_TXD_DTYP_DATA 0 /* Adv Data Descriptor */
#define WX_TXD_PAYLEN_SHIFT 13 /* Desc PAYLEN shift */
#define WX_TXD_EOP BIT(24) /* End of Packet */
#define WX_TXD_IFCS BIT(25) /* Insert FCS */
#define WX_TXD_RS BIT(27) /* Report Status */
/* Host Interface Command Structures */ /* Host Interface Command Structures */
struct wx_hic_hdr { struct wx_hic_hdr {
u8 cmd; u8 cmd;
...@@ -496,6 +513,8 @@ union wx_rx_desc { ...@@ -496,6 +513,8 @@ union wx_rx_desc {
#define WX_RX_DESC(R, i) \ #define WX_RX_DESC(R, i) \
(&(((union wx_rx_desc *)((R)->desc))[i])) (&(((union wx_rx_desc *)((R)->desc))[i]))
#define WX_TX_DESC(R, i) \
(&(((union wx_tx_desc *)((R)->desc))[i]))
/* wrapper around a pointer to a socket buffer, /* wrapper around a pointer to a socket buffer,
* so a DMA handle can be stored along with the buffer * so a DMA handle can be stored along with the buffer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment