Skip to content

Commit f3120ac

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-07-17 This series contains updates to igb, ixgbe, ixgbevf, i40e, bnx2x, freescale, siena and dp83640. Jacob provides several patches to clarify the intended way to implement both SIOCSHWTSTAMP and ethtool's get_ts_info(). It is okay to support the specific filters in SIOCSHWTSTAMP by upscaling them to the generic filters. Alex Duyck provides a igb patch to pull the time stamp from the fragment before it gets added to the skb, to avoid a possible issue in which the fragment can possibly be less than IGB_RX_HDR_LEN due to the time stamp being pulled after the copybreak check. Also provides a ixgbevf patch to fold the ixgbevf_pull_tail() call into ixgbevf_add_rx_frag(), which gives the advantage that the fragment does not have to be modified after it is added to the skb. Fan provides patches for ixgbe/ixgbevf to set the receive hash type based on receive descriptor RSS type. Todd provides a fix for igb where on check for link on any media other than copper was not being detected since it was looking on the incorrect PHY page (due to the page being used gets switched before the function to check link gets executed). ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 0e55a42 + 2ba6c07 commit f3120ac

File tree

15 files changed

+134
-180
lines changed

15 files changed

+134
-180
lines changed

Documentation/networking/timestamping.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ the requested fine-grained filtering for incoming packets is not
359359
supported, the driver may time stamp more than just the requested types
360360
of packets.
361361

362+
Drivers are free to use a more permissive configuration than the requested
363+
configuration. It is expected that drivers should only implement directly the
364+
most generic mode that can be supported. For example if the hardware can
365+
support HWTSTAMP_FILTER_V2_EVENT, then it should generally always upscale
366+
HWTSTAMP_FILTER_V2_L2_SYNC_MESSAGE, and so forth, as HWTSTAMP_FILTER_V2_EVENT
367+
is more generic (and more useful to applications).
368+
362369
A driver which supports hardware time stamping shall update the struct
363370
with the actual, possibly more permissive configuration. If the
364371
requested packets cannot be time stamped, then nothing should be

drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,17 +3562,8 @@ static int bnx2x_get_ts_info(struct net_device *dev,
35623562

35633563
info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
35643564
(1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
3565-
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
3566-
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
35673565
(1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
3568-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
3569-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
3570-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
3571-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
3572-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
3573-
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
3574-
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
3575-
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ);
3566+
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
35763567

35773568
info->tx_types = (1 << HWTSTAMP_TX_OFF)|(1 << HWTSTAMP_TX_ON);
35783569

drivers/net/ethernet/freescale/fec_ptp.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,6 @@ int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr)
506506
break;
507507

508508
default:
509-
/*
510-
* register RXMTRL must be set in order to do V1 packets,
511-
* therefore it is not possible to time stamp both V1 Sync and
512-
* Delay_Req messages and hardware does not support
513-
* timestamping all packets => return error
514-
*/
515509
fep->hwts_rx_en = 1;
516510
config.rx_filter = HWTSTAMP_FILTER_ALL;
517511
break;

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,17 +1467,8 @@ static int i40e_get_ts_info(struct net_device *dev,
14671467
info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON);
14681468

14691469
info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
1470-
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
1471-
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
1472-
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
1473-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
1474-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
1475-
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
1476-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
1477-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
1478-
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
1479-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
1480-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ);
1470+
(1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
1471+
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
14811472

14821473
return 0;
14831474
}

drivers/net/ethernet/intel/igb/e1000_82575.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ static s32 igb_check_for_link_media_swap(struct e1000_hw *hw)
139139
if (ret_val)
140140
return ret_val;
141141

142-
/* reset page to 0 */
143-
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
144-
if (ret_val)
145-
return ret_val;
146142

147143
if (data & E1000_M88E1112_STATUS_LINK)
148144
port = E1000_MEDIA_PORT_OTHER;
@@ -151,8 +147,20 @@ static s32 igb_check_for_link_media_swap(struct e1000_hw *hw)
151147
if (port && (hw->dev_spec._82575.media_port != port)) {
152148
hw->dev_spec._82575.media_port = port;
153149
hw->dev_spec._82575.media_changed = true;
150+
}
151+
152+
if (port == E1000_MEDIA_PORT_COPPER) {
153+
/* reset page to 0 */
154+
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
155+
if (ret_val)
156+
return ret_val;
157+
igb_check_for_link_82575(hw);
154158
} else {
155-
ret_val = igb_check_for_link_82575(hw);
159+
igb_check_for_link_82575(hw);
160+
/* reset page to 0 */
161+
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
162+
if (ret_val)
163+
return ret_val;
156164
}
157165

158166
return 0;

drivers/net/ethernet/intel/igb/igb_ethtool.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,10 +2396,6 @@ static int igb_get_ts_info(struct net_device *dev,
23962396
info->rx_filters |=
23972397
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
23982398
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
2399-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
2400-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
2401-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
2402-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
24032399
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
24042400

24052401
return 0;

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 25 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6621,22 +6621,25 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
66216621
struct sk_buff *skb)
66226622
{
66236623
struct page *page = rx_buffer->page;
6624+
unsigned char *va = page_address(page) + rx_buffer->page_offset;
66246625
unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
66256626
#if (PAGE_SIZE < 8192)
66266627
unsigned int truesize = IGB_RX_BUFSZ;
66276628
#else
6628-
unsigned int truesize = ALIGN(size, L1_CACHE_BYTES);
6629+
unsigned int truesize = SKB_DATA_ALIGN(size);
66296630
#endif
6631+
unsigned int pull_len;
66306632

6631-
if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) {
6632-
unsigned char *va = page_address(page) + rx_buffer->page_offset;
6633+
if (unlikely(skb_is_nonlinear(skb)))
6634+
goto add_tail_frag;
66336635

6634-
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6635-
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
6636-
va += IGB_TS_HDR_LEN;
6637-
size -= IGB_TS_HDR_LEN;
6638-
}
6636+
if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) {
6637+
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
6638+
va += IGB_TS_HDR_LEN;
6639+
size -= IGB_TS_HDR_LEN;
6640+
}
66396641

6642+
if (likely(size <= IGB_RX_HDR_LEN)) {
66406643
memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));
66416644

66426645
/* page is not reserved, we can reuse buffer as-is */
@@ -6648,8 +6651,21 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
66486651
return false;
66496652
}
66506653

6654+
/* we need the header to contain the greater of either ETH_HLEN or
6655+
* 60 bytes if the skb->len is less than 60 for skb_pad.
6656+
*/
6657+
pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);
6658+
6659+
/* align pull length to size of long to optimize memcpy performance */
6660+
memcpy(__skb_put(skb, pull_len), va, ALIGN(pull_len, sizeof(long)));
6661+
6662+
/* update all of the pointers */
6663+
va += pull_len;
6664+
size -= pull_len;
6665+
6666+
add_tail_frag:
66516667
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
6652-
rx_buffer->page_offset, size, truesize);
6668+
(unsigned long)va & ~PAGE_MASK, size, truesize);
66536669

66546670
return igb_can_reuse_rx_page(rx_buffer, page, truesize);
66556671
}
@@ -6790,62 +6806,6 @@ static bool igb_is_non_eop(struct igb_ring *rx_ring,
67906806
return true;
67916807
}
67926808

6793-
/**
6794-
* igb_pull_tail - igb specific version of skb_pull_tail
6795-
* @rx_ring: rx descriptor ring packet is being transacted on
6796-
* @rx_desc: pointer to the EOP Rx descriptor
6797-
* @skb: pointer to current skb being adjusted
6798-
*
6799-
* This function is an igb specific version of __pskb_pull_tail. The
6800-
* main difference between this version and the original function is that
6801-
* this function can make several assumptions about the state of things
6802-
* that allow for significant optimizations versus the standard function.
6803-
* As a result we can do things like drop a frag and maintain an accurate
6804-
* truesize for the skb.
6805-
*/
6806-
static void igb_pull_tail(struct igb_ring *rx_ring,
6807-
union e1000_adv_rx_desc *rx_desc,
6808-
struct sk_buff *skb)
6809-
{
6810-
struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];
6811-
unsigned char *va;
6812-
unsigned int pull_len;
6813-
6814-
/* it is valid to use page_address instead of kmap since we are
6815-
* working with pages allocated out of the lomem pool per
6816-
* alloc_page(GFP_ATOMIC)
6817-
*/
6818-
va = skb_frag_address(frag);
6819-
6820-
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6821-
/* retrieve timestamp from buffer */
6822-
igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
6823-
6824-
/* update pointers to remove timestamp header */
6825-
skb_frag_size_sub(frag, IGB_TS_HDR_LEN);
6826-
frag->page_offset += IGB_TS_HDR_LEN;
6827-
skb->data_len -= IGB_TS_HDR_LEN;
6828-
skb->len -= IGB_TS_HDR_LEN;
6829-
6830-
/* move va to start of packet data */
6831-
va += IGB_TS_HDR_LEN;
6832-
}
6833-
6834-
/* we need the header to contain the greater of either ETH_HLEN or
6835-
* 60 bytes if the skb->len is less than 60 for skb_pad.
6836-
*/
6837-
pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN);
6838-
6839-
/* align pull length to size of long to optimize memcpy performance */
6840-
skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));
6841-
6842-
/* update all of the pointers */
6843-
skb_frag_size_sub(frag, pull_len);
6844-
frag->page_offset += pull_len;
6845-
skb->data_len -= pull_len;
6846-
skb->tail += pull_len;
6847-
}
6848-
68496809
/**
68506810
* igb_cleanup_headers - Correct corrupted or empty headers
68516811
* @rx_ring: rx descriptor ring packet is being transacted on
@@ -6873,10 +6833,6 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
68736833
}
68746834
}
68756835

6876-
/* place header in linear portion of buffer */
6877-
if (skb_is_nonlinear(skb))
6878-
igb_pull_tail(rx_ring, rx_desc, skb);
6879-
68806836
/* if eth_skb_pad returns an error the skb was freed */
68816837
if (eth_skb_pad(skb))
68826838
return true;

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,14 +1394,12 @@ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl)
13941394
/*
13951395
* Continue setup of fdirctrl register bits:
13961396
* Turn perfect match filtering on
1397-
* Report hash in RSS field of Rx wb descriptor
13981397
* Initialize the drop queue
13991398
* Move the flexible bytes to use the ethertype - shift 6 words
14001399
* Set the maximum length per hash bucket to 0xA filters
14011400
* Send interrupt when 64 (0x4 * 16) filters are left
14021401
*/
14031402
fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH |
1404-
IXGBE_FDIRCTRL_REPORT_STATUS |
14051403
(IXGBE_FDIR_DROP_QUEUE << IXGBE_FDIRCTRL_DROP_Q_SHIFT) |
14061404
(0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) |
14071405
(0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) |

drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,14 +2938,6 @@ static int ixgbe_get_ts_info(struct net_device *dev,
29382938
(1 << HWTSTAMP_FILTER_NONE) |
29392939
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) |
29402940
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
2941-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
2942-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
2943-
(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
2944-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
2945-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
2946-
(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
2947-
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
2948-
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
29492941
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
29502942
break;
29512943
default:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,14 +1360,31 @@ static int __ixgbe_notify_dca(struct device *dev, void *data)
13601360
}
13611361

13621362
#endif /* CONFIG_IXGBE_DCA */
1363+
1364+
#define IXGBE_RSS_L4_TYPES_MASK \
1365+
((1ul << IXGBE_RXDADV_RSSTYPE_IPV4_TCP) | \
1366+
(1ul << IXGBE_RXDADV_RSSTYPE_IPV4_UDP) | \
1367+
(1ul << IXGBE_RXDADV_RSSTYPE_IPV6_TCP) | \
1368+
(1ul << IXGBE_RXDADV_RSSTYPE_IPV6_UDP))
1369+
13631370
static inline void ixgbe_rx_hash(struct ixgbe_ring *ring,
13641371
union ixgbe_adv_rx_desc *rx_desc,
13651372
struct sk_buff *skb)
13661373
{
1367-
if (ring->netdev->features & NETIF_F_RXHASH)
1368-
skb_set_hash(skb,
1369-
le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
1370-
PKT_HASH_TYPE_L3);
1374+
u16 rss_type;
1375+
1376+
if (!(ring->netdev->features & NETIF_F_RXHASH))
1377+
return;
1378+
1379+
rss_type = le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.pkt_info) &
1380+
IXGBE_RXDADV_RSSTYPE_MASK;
1381+
1382+
if (!rss_type)
1383+
return;
1384+
1385+
skb_set_hash(skb, le32_to_cpu(rx_desc->wb.lower.hi_dword.rss),
1386+
(IXGBE_RSS_L4_TYPES_MASK & (1ul << rss_type)) ?
1387+
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
13711388
}
13721389

13731390
#ifdef IXGBE_FCOE

drivers/net/ethernet/intel/ixgbevf/defines.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ typedef u32 ixgbe_link_speed;
161161
#define IXGBE_RXDADV_SPLITHEADER_EN 0x00001000
162162
#define IXGBE_RXDADV_SPH 0x8000
163163

164+
/* RSS Hash results */
165+
#define IXGBE_RXDADV_RSSTYPE_NONE 0x00000000
166+
#define IXGBE_RXDADV_RSSTYPE_IPV4_TCP 0x00000001
167+
#define IXGBE_RXDADV_RSSTYPE_IPV4 0x00000002
168+
#define IXGBE_RXDADV_RSSTYPE_IPV6_TCP 0x00000003
169+
#define IXGBE_RXDADV_RSSTYPE_IPV6_EX 0x00000004
170+
#define IXGBE_RXDADV_RSSTYPE_IPV6 0x00000005
171+
#define IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006
172+
#define IXGBE_RXDADV_RSSTYPE_IPV4_UDP 0x00000007
173+
#define IXGBE_RXDADV_RSSTYPE_IPV6_UDP 0x00000008
174+
#define IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009
175+
164176
#define IXGBE_RXD_ERR_FRAME_ERR_MASK ( \
165177
IXGBE_RXD_ERR_CE | \
166178
IXGBE_RXD_ERR_LE | \

0 commit comments

Comments
 (0)