aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-01-04 13:33:30 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-04 13:33:30 -0500
commitc030af878f04b77011f6876e8c4f0530c26ed6d4 (patch)
treea7413917257142a43be1d3c58cdef4e7e2112bdd
parentcd7aeb1f9706b665ad8659df8ff036e7bc0097f4 (diff)
parent38e5a85562a6cd911fc26d951d576551a688574c (diff)
Merge branch 'systemport-padding-and-TSB-insertion'
Florian Fainelli says: ==================== net: systemport: Fix padding vs. TSB insertion This patch series fixes how we pad the packets submitted to the SYSTEMPORT adapter, and how the transmit status block (prepended 8 bytes) fits in the picture. The first patch is not technically a bug fix, but is required for the second path to be applied and to greatly simplify the skb length calculation. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 25d1eb4933d0..7e8cf213fd81 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1012,15 +1012,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1012 goto out; 1012 goto out;
1013 } 1013 }
1014 1014
1015 /* Insert TSB and checksum infos */
1016 if (priv->tsb_en) {
1017 skb = bcm_sysport_insert_tsb(skb, dev);
1018 if (!skb) {
1019 ret = NETDEV_TX_OK;
1020 goto out;
1021 }
1022 }
1023
1024 /* The Ethernet switch we are interfaced with needs packets to be at 1015 /* The Ethernet switch we are interfaced with needs packets to be at
1025 * least 64 bytes (including FCS) otherwise they will be discarded when 1016 * least 64 bytes (including FCS) otherwise they will be discarded when
1026 * they enter the switch port logic. When Broadcom tags are enabled, we 1017 * they enter the switch port logic. When Broadcom tags are enabled, we
@@ -1028,13 +1019,21 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1028 * (including FCS and tag) because the length verification is done after 1019 * (including FCS and tag) because the length verification is done after
1029 * the Broadcom tag is stripped off the ingress packet. 1020 * the Broadcom tag is stripped off the ingress packet.
1030 */ 1021 */
1031 if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) { 1022 if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
1032 ret = NETDEV_TX_OK; 1023 ret = NETDEV_TX_OK;
1033 goto out; 1024 goto out;
1034 } 1025 }
1035 1026
1036 skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ? 1027 /* Insert TSB and checksum infos */
1037 ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len; 1028 if (priv->tsb_en) {
1029 skb = bcm_sysport_insert_tsb(skb, dev);
1030 if (!skb) {
1031 ret = NETDEV_TX_OK;
1032 goto out;
1033 }
1034 }
1035
1036 skb_len = skb->len;
1038 1037
1039 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); 1038 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
1040 if (dma_mapping_error(kdev, mapping)) { 1039 if (dma_mapping_error(kdev, mapping)) {