aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2015-02-05 22:30:50 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-08 01:46:25 -0500
commit6e74d1749a338d1435b413a92968f7e3de7c0278 (patch)
tree4f23c97b24cd15ee4774f9666398f3456abd89e5
parentccc39faf58113b33ed100b7c24d806538ac75df7 (diff)
r8152: replace get_protocol with vlan_get_protocol
vlan_get_protocol() has been defined and use it to replace get_protocol(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/r8152.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 8bdd4773233e..24e6aef907eb 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1330,18 +1330,6 @@ static struct tx_agg *r8152_get_tx_agg(struct r8152 *tp)
1330 return agg; 1330 return agg;
1331} 1331}
1332 1332
1333static inline __be16 get_protocol(struct sk_buff *skb)
1334{
1335 __be16 protocol;
1336
1337 if (skb->protocol == htons(ETH_P_8021Q))
1338 protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
1339 else
1340 protocol = skb->protocol;
1341
1342 return protocol;
1343}
1344
1345/* r8152_csum_workaround() 1333/* r8152_csum_workaround()
1346 * The hw limites the value the transport offset. When the offset is out of the 1334 * The hw limites the value the transport offset. When the offset is out of the
1347 * range, calculate the checksum by sw. 1335 * range, calculate the checksum by sw.
@@ -1447,7 +1435,7 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc,
1447 goto unavailable; 1435 goto unavailable;
1448 } 1436 }
1449 1437
1450 switch (get_protocol(skb)) { 1438 switch (vlan_get_protocol(skb)) {
1451 case htons(ETH_P_IP): 1439 case htons(ETH_P_IP):
1452 opts1 |= GTSENDV4; 1440 opts1 |= GTSENDV4;
1453 break; 1441 break;
@@ -1478,7 +1466,7 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc,
1478 goto unavailable; 1466 goto unavailable;
1479 } 1467 }
1480 1468
1481 switch (get_protocol(skb)) { 1469 switch (vlan_get_protocol(skb)) {
1482 case htons(ETH_P_IP): 1470 case htons(ETH_P_IP):
1483 opts2 |= IPV4_CS; 1471 opts2 |= IPV4_CS;
1484 ip_protocol = ip_hdr(skb)->protocol; 1472 ip_protocol = ip_hdr(skb)->protocol;