Skip to content

Commit

Permalink
Merge branch 'xgbe-next'
Browse files Browse the repository at this point in the history
Tom Lendacky says:

====================
amd-xgbe: AMD 10Gb Ethernet driver updates

The following series fixes some bugs and provides new/changed support
in the driver.

- Make all the defines in the xgbe.h file unique by prefixing them with
  XGBE_ if they are not currently using the prefix.
- VLAN CTAGs are supplied in context descriptors. Tell the hardware to
  look in the Tx context descriptor, and not a register, for the VLAN CTAG
  to be inserted in the packet.
- The hardware will indicate a VLAN packet has been received even if VLAN
  CTAG stripping is currently disabled.  Only indicate that a VLAN CTAG
  has been stripped for the current packet if stripping is enabled.
- Add support for VLAN filtering
- Modify destination address filtering to use the hardware hash tables
- Eliminate a checkpatch warning by replacing sscanf with kstrtouint

This patch series is based on net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 27, 2014
2 parents 9b8d90b + 66f95c3 commit f5b2650
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 189 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/amd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ config AMD_XGBE
depends on OF_NET
select PHYLIB
select AMD_XGBE_PHY
select BITREVERSE
select CRC32
---help---
This driver supports the AMD 10GbE Ethernet device found on an
AMD SoC.
Expand Down
26 changes: 19 additions & 7 deletions drivers/net/ethernet/amd/xgbe/xgbe-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,6 @@
#define MAC_PFR 0x0008
#define MAC_WTR 0x000c
#define MAC_HTR0 0x0010
#define MAC_HTR1 0x0014
#define MAC_HTR2 0x0018
#define MAC_HTR3 0x001c
#define MAC_HTR4 0x0020
#define MAC_HTR5 0x0024
#define MAC_HTR6 0x0028
#define MAC_HTR7 0x002c
#define MAC_VLANTR 0x0050
#define MAC_VLANHTR 0x0058
#define MAC_VLANIR 0x0060
Expand Down Expand Up @@ -315,6 +308,7 @@

#define MAC_QTFCR_INC 4
#define MAC_MACA_INC 4
#define MAC_HTR_INC 4

/* MAC register entry bit positions and sizes */
#define MAC_HWF0R_ADDMACADRSEL_INDEX 18
Expand Down Expand Up @@ -387,12 +381,16 @@
#define MAC_MACA1HR_AE_WIDTH 1
#define MAC_PFR_HMC_INDEX 2
#define MAC_PFR_HMC_WIDTH 1
#define MAC_PFR_HPF_INDEX 10
#define MAC_PFR_HPF_WIDTH 1
#define MAC_PFR_HUC_INDEX 1
#define MAC_PFR_HUC_WIDTH 1
#define MAC_PFR_PM_INDEX 4
#define MAC_PFR_PM_WIDTH 1
#define MAC_PFR_PR_INDEX 0
#define MAC_PFR_PR_WIDTH 1
#define MAC_PFR_VTFE_INDEX 16
#define MAC_PFR_VTFE_WIDTH 1
#define MAC_PMTCSR_MGKPKTEN_INDEX 1
#define MAC_PMTCSR_MGKPKTEN_WIDTH 1
#define MAC_PMTCSR_PWRDWN_INDEX 0
Expand Down Expand Up @@ -427,16 +425,30 @@
#define MAC_TCR_SS_WIDTH 2
#define MAC_TCR_TE_INDEX 0
#define MAC_TCR_TE_WIDTH 1
#define MAC_VLANHTR_VLHT_INDEX 0
#define MAC_VLANHTR_VLHT_WIDTH 16
#define MAC_VLANIR_VLTI_INDEX 20
#define MAC_VLANIR_VLTI_WIDTH 1
#define MAC_VLANIR_CSVL_INDEX 19
#define MAC_VLANIR_CSVL_WIDTH 1
#define MAC_VLANTR_DOVLTC_INDEX 20
#define MAC_VLANTR_DOVLTC_WIDTH 1
#define MAC_VLANTR_ERSVLM_INDEX 19
#define MAC_VLANTR_ERSVLM_WIDTH 1
#define MAC_VLANTR_ESVL_INDEX 18
#define MAC_VLANTR_ESVL_WIDTH 1
#define MAC_VLANTR_ETV_INDEX 16
#define MAC_VLANTR_ETV_WIDTH 1
#define MAC_VLANTR_EVLS_INDEX 21
#define MAC_VLANTR_EVLS_WIDTH 2
#define MAC_VLANTR_EVLRXS_INDEX 24
#define MAC_VLANTR_EVLRXS_WIDTH 1
#define MAC_VLANTR_VL_INDEX 0
#define MAC_VLANTR_VL_WIDTH 16
#define MAC_VLANTR_VTHM_INDEX 25
#define MAC_VLANTR_VTHM_WIDTH 1
#define MAC_VLANTR_VTIM_INDEX 17
#define MAC_VLANTR_VTIM_WIDTH 1
#define MAC_VR_DEVID_INDEX 8
#define MAC_VR_DEVID_WIDTH 8
#define MAC_VR_SNPSVER_INDEX 0
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
{
char workarea[32];
ssize_t len;
unsigned int scan_value;
int ret;

if (*ppos != 0)
return 0;
Expand All @@ -165,10 +165,9 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
return len;

workarea[len] = '\0';
if (sscanf(workarea, "%x", &scan_value) == 1)
*value = scan_value;
else
return -EIO;
ret = kstrtouint(workarea, 0, value);
if (ret)
return ret;

return len;
}
Expand Down
23 changes: 12 additions & 11 deletions drivers/net/ethernet/amd/xgbe/xgbe-desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void xgbe_free_ring(struct xgbe_prv_data *pdata,

if (ring->rdata) {
for (i = 0; i < ring->rdesc_count; i++) {
rdata = GET_DESC_DATA(ring, i);
rdata = XGBE_GET_DESC_DATA(ring, i);
xgbe_unmap_skb(pdata, rdata);
}

Expand Down Expand Up @@ -256,7 +256,7 @@ static void xgbe_wrapper_tx_descriptor_init(struct xgbe_prv_data *pdata)
rdesc_dma = ring->rdesc_dma;

for (j = 0; j < ring->rdesc_count; j++) {
rdata = GET_DESC_DATA(ring, j);
rdata = XGBE_GET_DESC_DATA(ring, j);

rdata->rdesc = rdesc;
rdata->rdesc_dma = rdesc_dma;
Expand Down Expand Up @@ -298,7 +298,7 @@ static void xgbe_wrapper_rx_descriptor_init(struct xgbe_prv_data *pdata)
rdesc_dma = ring->rdesc_dma;

for (j = 0; j < ring->rdesc_count; j++) {
rdata = GET_DESC_DATA(ring, j);
rdata = XGBE_GET_DESC_DATA(ring, j);

rdata->rdesc = rdesc;
rdata->rdesc_dma = rdesc_dma;
Expand Down Expand Up @@ -392,7 +392,7 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)
if ((tso && (packet->mss != ring->tx.cur_mss)) ||
(vlan && (packet->vlan_ctag != ring->tx.cur_vlan_ctag)))
cur_index++;
rdata = GET_DESC_DATA(ring, cur_index);
rdata = XGBE_GET_DESC_DATA(ring, cur_index);

if (tso) {
DBGPR(" TSO packet\n");
Expand All @@ -413,12 +413,12 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)
packet->length += packet->header_len;

cur_index++;
rdata = GET_DESC_DATA(ring, cur_index);
rdata = XGBE_GET_DESC_DATA(ring, cur_index);
}

/* Map the (remainder of the) packet */
for (datalen = skb_headlen(skb) - offset; datalen; ) {
len = min_t(unsigned int, datalen, TX_MAX_BUF_SIZE);
len = min_t(unsigned int, datalen, XGBE_TX_MAX_BUF_SIZE);

skb_dma = dma_map_single(pdata->dev, skb->data + offset, len,
DMA_TO_DEVICE);
Expand All @@ -437,7 +437,7 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)
packet->length += len;

cur_index++;
rdata = GET_DESC_DATA(ring, cur_index);
rdata = XGBE_GET_DESC_DATA(ring, cur_index);
}

for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
Expand All @@ -447,7 +447,8 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)
offset = 0;

for (datalen = skb_frag_size(frag); datalen; ) {
len = min_t(unsigned int, datalen, TX_MAX_BUF_SIZE);
len = min_t(unsigned int, datalen,
XGBE_TX_MAX_BUF_SIZE);

skb_dma = skb_frag_dma_map(pdata->dev, frag, offset,
len, DMA_TO_DEVICE);
Expand All @@ -468,7 +469,7 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)
packet->length += len;

cur_index++;
rdata = GET_DESC_DATA(ring, cur_index);
rdata = XGBE_GET_DESC_DATA(ring, cur_index);
}
}

Expand All @@ -484,7 +485,7 @@ static int xgbe_map_tx_skb(struct xgbe_channel *channel, struct sk_buff *skb)

err_out:
while (start_index < cur_index) {
rdata = GET_DESC_DATA(ring, start_index++);
rdata = XGBE_GET_DESC_DATA(ring, start_index++);
xgbe_unmap_skb(pdata, rdata);
}

Expand All @@ -507,7 +508,7 @@ static void xgbe_realloc_skb(struct xgbe_channel *channel)
ring->rx.realloc_index);

for (i = 0; i < ring->dirty; i++) {
rdata = GET_DESC_DATA(ring, ring->rx.realloc_index);
rdata = XGBE_GET_DESC_DATA(ring, ring->rx.realloc_index);

/* Reset rdata values */
xgbe_unmap_skb(pdata, rdata);
Expand Down
Loading

0 comments on commit f5b2650

Please sign in to comment.