diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-01-18 20:17:28 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-01-18 20:17:28 +0000 |
commit | 7e7a5831f715435be276b7a7b3b6e879464a3699 (patch) | |
tree | 1c9675e9c7b3bd97c75c503138079ffccb1e34bc | |
parent | 2a76888e3f403821d79d62aa09c1e698da8f835a (diff) | |
download | master-187ad058-7e7a5831f715435be276b7a7b3b6e879464a3699.tar.gz master-187ad058-7e7a5831f715435be276b7a7b3b6e879464a3699.tar.bz2 master-187ad058-7e7a5831f715435be276b7a7b3b6e879464a3699.zip |
ralink: improve check rx sg function. use check frags instead of function call
Signed-off-by: michael lee <igvtee@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44046 3c298f89-4303-0410-b956-a3cf2f4a3e73
3 files changed, 8 insertions, 14 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c index 5a681f8e43..ad74550a4d 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.c @@ -271,8 +271,8 @@ static int fe_alloc_rx(struct fe_priv *priv) goto no_rx_mem; priv->rx_dma[i].rxd1 = (unsigned int) dma_addr; - if (priv->soc->rx_dma) - priv->soc->rx_dma(&priv->rx_dma[i], priv->rx_buf_size); + if (priv->flags & FE_FLAG_RX_SG_DMA) + priv->rx_dma[i].rxd2 = RX_DMA_PLEN0(priv->rx_buf_size); else priv->rx_dma[i].rxd2 = RX_DMA_LSO; } @@ -827,8 +827,8 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, rxd->rxd1 = (unsigned int) dma_addr; release_desc: - if (soc->rx_dma) - soc->rx_dma(rxd, priv->rx_buf_size); + if (priv->flags & FE_FLAG_RX_SG_DMA) + rxd->rxd2 = RX_DMA_PLEN0(priv->rx_buf_size); else rxd->rxd2 = RX_DMA_LSO; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h index 56bef3453f..9bbd8d4c6a 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h @@ -380,7 +380,6 @@ struct fe_soc_data void (*set_mac)(struct fe_priv *priv, unsigned char *mac); int (*fwd_config)(struct fe_priv *priv); void (*tx_dma)(struct fe_tx_dma *txd); - void (*rx_dma)(struct fe_rx_dma *rxd, u16 len); int (*switch_init)(struct fe_priv *priv); int (*switch_config)(struct fe_priv *priv); void (*port_init)(struct fe_priv *priv, struct device_node *port); diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c index 05f3708794..5a7ee35eb0 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c @@ -168,17 +168,13 @@ static void mt7621_tx_dma(struct fe_tx_dma *txd) txd->txd4 = BIT(25); } -static void mt7620_rx_dma(struct fe_rx_dma *rxd, u16 len) -{ - rxd->rxd2 = RX_DMA_PLEN0(len); -} - static void mt7620_init_data(struct fe_soc_data *data, struct net_device *netdev) { struct fe_priv *priv = netdev_priv(netdev); - priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET; + priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET | + FE_FLAG_RX_SG_DMA; netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX; @@ -192,7 +188,8 @@ static void mt7621_init_data(struct fe_soc_data *data, { struct fe_priv *priv = netdev_priv(netdev); - priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET; + priv->flags = FE_FLAG_PADDING_64B | FE_FLAG_RX_2B_OFFSET | + FE_FLAG_RX_SG_DMA; netdev->hw_features = NETIF_F_HW_VLAN_CTAG_TX; } @@ -214,7 +211,6 @@ static struct fe_soc_data mt7620_data = { .set_mac = mt7620_set_mac, .fwd_config = mt7620_fwd_config, .tx_dma = mt7620_tx_dma, - .rx_dma = mt7620_rx_dma, .switch_init = mt7620_gsw_probe, .switch_config = mt7620_gsw_config, .port_init = mt7620_port_init, @@ -237,7 +233,6 @@ static struct fe_soc_data mt7621_data = { .set_mac = mt7621_set_mac, .fwd_config = mt7621_fwd_config, .tx_dma = mt7621_tx_dma, - .rx_dma = mt7620_rx_dma, .switch_init = mt7620_gsw_probe, .switch_config = mt7621_gsw_config, .reg_table = mt7621_reg_table, |