diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2019-07-10 00:14:49 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-09 14:46:40 -0700 |
commit | a22502a37599f813686e443ccfc21c9ea8167c41 (patch) | |
tree | 4f95c6acb2112aacb1d46e7d337fe9d0d8169d27 /drivers/net/ethernet/socionext | |
parent | 4831539dce552b7d47a7a3f3cbc440669a3917e2 (diff) |
net: netsec: remove static declaration for netsec_set_tx_de()
On commit ba2b232108d3 ("net: netsec: add XDP support") a static
declaration for netsec_set_tx_de() was added to make the diff easier
to read. Now that the patch is merged let's move the functions around
and get rid of that
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/socionext')
-rw-r--r-- | drivers/net/ethernet/socionext/netsec.c | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 7f9280f1fb28..1502fe8b0456 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -328,11 +328,6 @@ struct netsec_rx_pkt_info { bool err_flag; }; -static void netsec_set_tx_de(struct netsec_priv *priv, - struct netsec_desc_ring *dring, - const struct netsec_tx_pkt_ctrl *tx_ctrl, - const struct netsec_desc *desc, void *buf); - static void netsec_write(struct netsec_priv *priv, u32 reg_addr, u32 val) { writel(val, priv->ioaddr + reg_addr); @@ -778,6 +773,47 @@ static void netsec_finalize_xdp_rx(struct netsec_priv *priv, u32 xdp_res, netsec_xdp_ring_tx_db(priv, pkts); } +static void netsec_set_tx_de(struct netsec_priv *priv, + struct netsec_desc_ring *dring, + const struct netsec_tx_pkt_ctrl *tx_ctrl, + const struct netsec_desc *desc, void *buf) +{ + int idx = dring->head; + struct netsec_de *de; + u32 attr; + + de = dring->vaddr + (DESC_SZ * idx); + + attr = (1 << NETSEC_TX_SHIFT_OWN_FIELD) | + (1 << NETSEC_TX_SHIFT_PT_FIELD) | + (NETSEC_RING_GMAC << NETSEC_TX_SHIFT_TDRID_FIELD) | + (1 << NETSEC_TX_SHIFT_FS_FIELD) | + (1 << NETSEC_TX_LAST) | + (tx_ctrl->cksum_offload_flag << NETSEC_TX_SHIFT_CO) | + (tx_ctrl->tcp_seg_offload_flag << NETSEC_TX_SHIFT_SO) | + (1 << NETSEC_TX_SHIFT_TRS_FIELD); + if (idx == DESC_NUM - 1) + attr |= (1 << NETSEC_TX_SHIFT_LD_FIELD); + + de->data_buf_addr_up = upper_32_bits(desc->dma_addr); + de->data_buf_addr_lw = lower_32_bits(desc->dma_addr); + de->buf_len_info = (tx_ctrl->tcp_seg_len << 16) | desc->len; + de->attr = attr; + /* under spin_lock if using XDP */ + if (!dring->is_xdp) + dma_wmb(); + + dring->desc[idx] = *desc; + if (desc->buf_type == TYPE_NETSEC_SKB) + dring->desc[idx].skb = buf; + else if (desc->buf_type == TYPE_NETSEC_XDP_TX || + desc->buf_type == TYPE_NETSEC_XDP_NDO) + dring->desc[idx].xdpf = buf; + + /* move head ahead */ + dring->head = (dring->head + 1) % DESC_NUM; +} + /* The current driver only supports 1 Txq, this should run under spin_lock() */ static u32 netsec_xdp_queue_one(struct netsec_priv *priv, struct xdp_frame *xdpf, bool is_ndo) @@ -1041,46 +1077,6 @@ static int netsec_napi_poll(struct napi_struct *napi, int budget) return done; } -static void netsec_set_tx_de(struct netsec_priv *priv, - struct netsec_desc_ring *dring, - const struct netsec_tx_pkt_ctrl *tx_ctrl, - const struct netsec_desc *desc, void *buf) -{ - int idx = dring->head; - struct netsec_de *de; - u32 attr; - - de = dring->vaddr + (DESC_SZ * idx); - - attr = (1 << NETSEC_TX_SHIFT_OWN_FIELD) | - (1 << NETSEC_TX_SHIFT_PT_FIELD) | - (NETSEC_RING_GMAC << NETSEC_TX_SHIFT_TDRID_FIELD) | - (1 << NETSEC_TX_SHIFT_FS_FIELD) | - (1 << NETSEC_TX_LAST) | - (tx_ctrl->cksum_offload_flag << NETSEC_TX_SHIFT_CO) | - (tx_ctrl->tcp_seg_offload_flag << NETSEC_TX_SHIFT_SO) | - (1 << NETSEC_TX_SHIFT_TRS_FIELD); - if (idx == DESC_NUM - 1) - attr |= (1 << NETSEC_TX_SHIFT_LD_FIELD); - - de->data_buf_addr_up = upper_32_bits(desc->dma_addr); - de->data_buf_addr_lw = lower_32_bits(desc->dma_addr); - de->buf_len_info = (tx_ctrl->tcp_seg_len << 16) | desc->len; - de->attr = attr; - /* under spin_lock if using XDP */ - if (!dring->is_xdp) - dma_wmb(); - - dring->desc[idx] = *desc; - if (desc->buf_type == TYPE_NETSEC_SKB) - dring->desc[idx].skb = buf; - else if (desc->buf_type == TYPE_NETSEC_XDP_TX || - desc->buf_type == TYPE_NETSEC_XDP_NDO) - dring->desc[idx].xdpf = buf; - - /* move head ahead */ - dring->head = (dring->head + 1) % DESC_NUM; -} static int netsec_desc_used(struct netsec_desc_ring *dring) { |