ralink: improve check rx sg function. use check frags instead of function call

Signed-off-by: michael lee <igvtee@gmail.com>

SVN-Revision: 44046
This commit is contained in:
Felix Fietkau 2015-01-18 20:17:28 +00:00
parent b3ca42ec8f
commit a4460ca5a7
3 changed files with 8 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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,