diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-15 18:37:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-15 18:37:05 -0400 |
commit | 91c8028c95a468da9c0aafd2d91cf24e27784206 (patch) | |
tree | 4db0431781918451e2815dc0e629c795cfa10eb3 | |
parent | 81aded24675ebda5de8a68843250ad15584ac38a (diff) | |
parent | 1d1a79b5b94b0aa84e1e78dd9acdcffb12274848 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/param.c | 43 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/Makefile | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 149 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 37 |
8 files changed, 180 insertions, 79 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 31d37a2b5ba8..ba86b3f8a404 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -6238,7 +6238,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
6238 | } | 6238 | } |
6239 | 6239 | ||
6240 | if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) | 6240 | if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) |
6241 | e_info("PHY reset is blocked due to SOL/IDER session.\n"); | 6241 | dev_info(&pdev->dev, |
6242 | "PHY reset is blocked due to SOL/IDER session.\n"); | ||
6242 | 6243 | ||
6243 | /* Set initial default active device features */ | 6244 | /* Set initial default active device features */ |
6244 | netdev->features = (NETIF_F_SG | | 6245 | netdev->features = (NETIF_F_SG | |
@@ -6288,7 +6289,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
6288 | if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) | 6289 | if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) |
6289 | break; | 6290 | break; |
6290 | if (i == 2) { | 6291 | if (i == 2) { |
6291 | e_err("The NVM Checksum Is Not Valid\n"); | 6292 | dev_err(&pdev->dev, "The NVM Checksum Is Not Valid\n"); |
6292 | err = -EIO; | 6293 | err = -EIO; |
6293 | goto err_eeprom; | 6294 | goto err_eeprom; |
6294 | } | 6295 | } |
@@ -6298,13 +6299,15 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
6298 | 6299 | ||
6299 | /* copy the MAC address */ | 6300 | /* copy the MAC address */ |
6300 | if (e1000e_read_mac_addr(&adapter->hw)) | 6301 | if (e1000e_read_mac_addr(&adapter->hw)) |
6301 | e_err("NVM Read Error while reading MAC address\n"); | 6302 | dev_err(&pdev->dev, |
6303 | "NVM Read Error while reading MAC address\n"); | ||
6302 | 6304 | ||
6303 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); | 6305 | memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); |
6304 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 6306 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); |
6305 | 6307 | ||
6306 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 6308 | if (!is_valid_ether_addr(netdev->perm_addr)) { |
6307 | e_err("Invalid MAC Address: %pM\n", netdev->perm_addr); | 6309 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
6310 | netdev->perm_addr); | ||
6308 | err = -EIO; | 6311 | err = -EIO; |
6309 | goto err_eeprom; | 6312 | goto err_eeprom; |
6310 | } | 6313 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index 55cc1565bc2f..dfbfa7fd98c3 100644 --- a/drivers/net/ethernet/intel/e1000e/param.c +++ b/drivers/net/ethernet/intel/e1000e/param.c | |||
@@ -199,16 +199,19 @@ static int __devinit e1000_validate_option(unsigned int *value, | |||
199 | case enable_option: | 199 | case enable_option: |
200 | switch (*value) { | 200 | switch (*value) { |
201 | case OPTION_ENABLED: | 201 | case OPTION_ENABLED: |
202 | e_info("%s Enabled\n", opt->name); | 202 | dev_info(&adapter->pdev->dev, "%s Enabled\n", |
203 | opt->name); | ||
203 | return 0; | 204 | return 0; |
204 | case OPTION_DISABLED: | 205 | case OPTION_DISABLED: |
205 | e_info("%s Disabled\n", opt->name); | 206 | dev_info(&adapter->pdev->dev, "%s Disabled\n", |
207 | opt->name); | ||
206 | return 0; | 208 | return 0; |
207 | } | 209 | } |
208 | break; | 210 | break; |
209 | case range_option: | 211 | case range_option: |
210 | if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { | 212 | if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { |
211 | e_info("%s set to %i\n", opt->name, *value); | 213 | dev_info(&adapter->pdev->dev, "%s set to %i\n", |
214 | opt->name, *value); | ||
212 | return 0; | 215 | return 0; |
213 | } | 216 | } |
214 | break; | 217 | break; |
@@ -220,7 +223,8 @@ static int __devinit e1000_validate_option(unsigned int *value, | |||
220 | ent = &opt->arg.l.p[i]; | 223 | ent = &opt->arg.l.p[i]; |
221 | if (*value == ent->i) { | 224 | if (*value == ent->i) { |
222 | if (ent->str[0] != '\0') | 225 | if (ent->str[0] != '\0') |
223 | e_info("%s\n", ent->str); | 226 | dev_info(&adapter->pdev->dev, "%s\n", |
227 | ent->str); | ||
224 | return 0; | 228 | return 0; |
225 | } | 229 | } |
226 | } | 230 | } |
@@ -230,8 +234,8 @@ static int __devinit e1000_validate_option(unsigned int *value, | |||
230 | BUG(); | 234 | BUG(); |
231 | } | 235 | } |
232 | 236 | ||
233 | e_info("Invalid %s value specified (%i) %s\n", opt->name, *value, | 237 | dev_info(&adapter->pdev->dev, "Invalid %s value specified (%i) %s\n", |
234 | opt->err); | 238 | opt->name, *value, opt->err); |
235 | *value = opt->def; | 239 | *value = opt->def; |
236 | return -1; | 240 | return -1; |
237 | } | 241 | } |
@@ -251,8 +255,10 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
251 | int bd = adapter->bd_number; | 255 | int bd = adapter->bd_number; |
252 | 256 | ||
253 | if (bd >= E1000_MAX_NIC) { | 257 | if (bd >= E1000_MAX_NIC) { |
254 | e_notice("Warning: no configuration for board #%i\n", bd); | 258 | dev_notice(&adapter->pdev->dev, |
255 | e_notice("Using defaults for all values\n"); | 259 | "Warning: no configuration for board #%i\n", bd); |
260 | dev_notice(&adapter->pdev->dev, | ||
261 | "Using defaults for all values\n"); | ||
256 | } | 262 | } |
257 | 263 | ||
258 | { /* Transmit Interrupt Delay */ | 264 | { /* Transmit Interrupt Delay */ |
@@ -366,27 +372,32 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
366 | * default values | 372 | * default values |
367 | */ | 373 | */ |
368 | if (adapter->itr > 4) | 374 | if (adapter->itr > 4) |
369 | e_info("%s set to default %d\n", opt.name, | 375 | dev_info(&adapter->pdev->dev, |
370 | adapter->itr); | 376 | "%s set to default %d\n", opt.name, |
377 | adapter->itr); | ||
371 | } | 378 | } |
372 | 379 | ||
373 | adapter->itr_setting = adapter->itr; | 380 | adapter->itr_setting = adapter->itr; |
374 | switch (adapter->itr) { | 381 | switch (adapter->itr) { |
375 | case 0: | 382 | case 0: |
376 | e_info("%s turned off\n", opt.name); | 383 | dev_info(&adapter->pdev->dev, "%s turned off\n", |
384 | opt.name); | ||
377 | break; | 385 | break; |
378 | case 1: | 386 | case 1: |
379 | e_info("%s set to dynamic mode\n", opt.name); | 387 | dev_info(&adapter->pdev->dev, |
388 | "%s set to dynamic mode\n", opt.name); | ||
380 | adapter->itr = 20000; | 389 | adapter->itr = 20000; |
381 | break; | 390 | break; |
382 | case 3: | 391 | case 3: |
383 | e_info("%s set to dynamic conservative mode\n", | 392 | dev_info(&adapter->pdev->dev, |
384 | opt.name); | 393 | "%s set to dynamic conservative mode\n", |
394 | opt.name); | ||
385 | adapter->itr = 20000; | 395 | adapter->itr = 20000; |
386 | break; | 396 | break; |
387 | case 4: | 397 | case 4: |
388 | e_info("%s set to simplified (2000-8000 ints) mode\n", | 398 | dev_info(&adapter->pdev->dev, |
389 | opt.name); | 399 | "%s set to simplified (2000-8000 ints) mode\n", |
400 | opt.name); | ||
390 | break; | 401 | break; |
391 | default: | 402 | default: |
392 | /* | 403 | /* |
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile index 0bdf06bc5c49..5fd5d04c26c9 100644 --- a/drivers/net/ethernet/intel/ixgbe/Makefile +++ b/drivers/net/ethernet/intel/ixgbe/Makefile | |||
@@ -34,11 +34,11 @@ obj-$(CONFIG_IXGBE) += ixgbe.o | |||
34 | 34 | ||
35 | ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \ | 35 | ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \ |
36 | ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ | 36 | ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ |
37 | ixgbe_mbx.o ixgbe_x540.o ixgbe_sysfs.o ixgbe_lib.o | 37 | ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o |
38 | 38 | ||
39 | ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ | 39 | ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ |
40 | ixgbe_dcb_82599.o ixgbe_dcb_nl.o | 40 | ixgbe_dcb_82599.o ixgbe_dcb_nl.o |
41 | 41 | ||
42 | ixgbe-$(CONFIG_IXGBE_PTP) += ixgbe_ptp.o | 42 | ixgbe-$(CONFIG_IXGBE_PTP) += ixgbe_ptp.o |
43 | 43 | ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o | |
44 | ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o | 44 | ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 3ef3c5284e52..41f9f6e2a4c1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -561,6 +561,7 @@ struct ixgbe_adapter { | |||
561 | spinlock_t tmreg_lock; | 561 | spinlock_t tmreg_lock; |
562 | struct cyclecounter cc; | 562 | struct cyclecounter cc; |
563 | struct timecounter tc; | 563 | struct timecounter tc; |
564 | int rx_hwtstamp_filter; | ||
564 | u32 base_incval; | 565 | u32 base_incval; |
565 | u32 cycle_speed; | 566 | u32 cycle_speed; |
566 | #endif /* CONFIG_IXGBE_PTP */ | 567 | #endif /* CONFIG_IXGBE_PTP */ |
@@ -718,6 +719,7 @@ extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); | |||
718 | extern void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector, | 719 | extern void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector, |
719 | struct sk_buff *skb); | 720 | struct sk_buff *skb); |
720 | extern void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | 721 | extern void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, |
722 | union ixgbe_adv_rx_desc *rx_desc, | ||
721 | struct sk_buff *skb); | 723 | struct sk_buff *skb); |
722 | extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | 724 | extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, |
723 | struct ifreq *ifr, int cmd); | 725 | struct ifreq *ifr, int cmd); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 17ad6a3c1be1..b0ddfd47e473 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -790,12 +790,10 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, | |||
790 | total_packets += tx_buffer->gso_segs; | 790 | total_packets += tx_buffer->gso_segs; |
791 | 791 | ||
792 | #ifdef CONFIG_IXGBE_PTP | 792 | #ifdef CONFIG_IXGBE_PTP |
793 | if (unlikely(tx_buffer->tx_flags & | 793 | if (unlikely(tx_buffer->tx_flags & IXGBE_TX_FLAGS_TSTAMP)) |
794 | IXGBE_TX_FLAGS_TSTAMP)) | 794 | ixgbe_ptp_tx_hwtstamp(q_vector, tx_buffer->skb); |
795 | ixgbe_ptp_tx_hwtstamp(q_vector, | ||
796 | tx_buffer->skb); | ||
797 | |||
798 | #endif | 795 | #endif |
796 | |||
799 | /* free the skb */ | 797 | /* free the skb */ |
800 | dev_kfree_skb_any(tx_buffer->skb); | 798 | dev_kfree_skb_any(tx_buffer->skb); |
801 | 799 | ||
@@ -1399,8 +1397,7 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, | |||
1399 | ixgbe_rx_checksum(rx_ring, rx_desc, skb); | 1397 | ixgbe_rx_checksum(rx_ring, rx_desc, skb); |
1400 | 1398 | ||
1401 | #ifdef CONFIG_IXGBE_PTP | 1399 | #ifdef CONFIG_IXGBE_PTP |
1402 | if (ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS)) | 1400 | ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); |
1403 | ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb); | ||
1404 | #endif | 1401 | #endif |
1405 | 1402 | ||
1406 | if ((dev->features & NETIF_F_HW_VLAN_RX) && | 1403 | if ((dev->features & NETIF_F_HW_VLAN_RX) && |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index ddc6a4d19302..cb7d1b2982c5 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -26,6 +26,7 @@ | |||
26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
27 | #include "ixgbe.h" | 27 | #include "ixgbe.h" |
28 | #include <linux/export.h> | 28 | #include <linux/export.h> |
29 | #include <linux/ptp_classify.h> | ||
29 | 30 | ||
30 | /* | 31 | /* |
31 | * The 82599 and the X540 do not have true 64bit nanosecond scale | 32 | * The 82599 and the X540 do not have true 64bit nanosecond scale |
@@ -100,6 +101,10 @@ | |||
100 | #define NSECS_PER_SEC 1000000000ULL | 101 | #define NSECS_PER_SEC 1000000000ULL |
101 | #endif | 102 | #endif |
102 | 103 | ||
104 | static struct sock_filter ptp_filter[] = { | ||
105 | PTP_FILTER | ||
106 | }; | ||
107 | |||
103 | /** | 108 | /** |
104 | * ixgbe_ptp_read - read raw cycle counter (to be used by time counter) | 109 | * ixgbe_ptp_read - read raw cycle counter (to be used by time counter) |
105 | * @cc - the cyclecounter structure | 110 | * @cc - the cyclecounter structure |
@@ -307,13 +312,14 @@ void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr) | |||
307 | !(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) | 312 | !(adapter->flags2 & IXGBE_FLAG2_PTP_PPS_ENABLED)) |
308 | return; | 313 | return; |
309 | 314 | ||
310 | switch (hw->mac.type) { | 315 | if (unlikely(eicr & IXGBE_EICR_TIMESYNC)) { |
311 | case ixgbe_mac_X540: | 316 | switch (hw->mac.type) { |
312 | if (eicr & IXGBE_EICR_TIMESYNC) | 317 | case ixgbe_mac_X540: |
313 | ptp_clock_event(adapter->ptp_clock, &event); | 318 | ptp_clock_event(adapter->ptp_clock, &event); |
314 | break; | 319 | break; |
315 | default: | 320 | default: |
316 | break; | 321 | break; |
322 | } | ||
317 | } | 323 | } |
318 | } | 324 | } |
319 | 325 | ||
@@ -425,6 +431,68 @@ void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter) | |||
425 | } | 431 | } |
426 | 432 | ||
427 | /** | 433 | /** |
434 | * ixgbe_ptp_match - determine if this skb matches a ptp packet | ||
435 | * @skb: pointer to the skb | ||
436 | * @hwtstamp: pointer to the hwtstamp_config to check | ||
437 | * | ||
438 | * Determine whether the skb should have been timestamped, assuming the | ||
439 | * hwtstamp was set via the hwtstamp ioctl. Returns non-zero when the packet | ||
440 | * should have a timestamp waiting in the registers, and 0 otherwise. | ||
441 | * | ||
442 | * V1 packets have to check the version type to determine whether they are | ||
443 | * correct. However, we can't directly access the data because it might be | ||
444 | * fragmented in the SKB, in paged memory. In order to work around this, we | ||
445 | * use skb_copy_bits which will properly copy the data whether it is in the | ||
446 | * paged memory fragments or not. We have to copy the IP header as well as the | ||
447 | * message type. | ||
448 | */ | ||
449 | static int ixgbe_ptp_match(struct sk_buff *skb, int rx_filter) | ||
450 | { | ||
451 | struct iphdr iph; | ||
452 | u8 msgtype; | ||
453 | unsigned int type, offset; | ||
454 | |||
455 | if (rx_filter == HWTSTAMP_FILTER_NONE) | ||
456 | return 0; | ||
457 | |||
458 | type = sk_run_filter(skb, ptp_filter); | ||
459 | |||
460 | if (likely(rx_filter == HWTSTAMP_FILTER_PTP_V2_EVENT)) | ||
461 | return type & PTP_CLASS_V2; | ||
462 | |||
463 | /* For the remaining cases actually check message type */ | ||
464 | switch (type) { | ||
465 | case PTP_CLASS_V1_IPV4: | ||
466 | skb_copy_bits(skb, OFF_IHL, &iph, sizeof(iph)); | ||
467 | offset = ETH_HLEN + (iph.ihl << 2) + UDP_HLEN + OFF_PTP_CONTROL; | ||
468 | break; | ||
469 | case PTP_CLASS_V1_IPV6: | ||
470 | offset = OFF_PTP6 + OFF_PTP_CONTROL; | ||
471 | break; | ||
472 | default: | ||
473 | /* other cases invalid or handled above */ | ||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | /* Make sure our buffer is long enough */ | ||
478 | if (skb->len < offset) | ||
479 | return 0; | ||
480 | |||
481 | skb_copy_bits(skb, offset, &msgtype, sizeof(msgtype)); | ||
482 | |||
483 | switch (rx_filter) { | ||
484 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: | ||
485 | return (msgtype == IXGBE_RXMTRL_V1_SYNC_MSG); | ||
486 | break; | ||
487 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: | ||
488 | return (msgtype == IXGBE_RXMTRL_V1_DELAY_REQ_MSG); | ||
489 | break; | ||
490 | default: | ||
491 | return 0; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | /** | ||
428 | * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp | 496 | * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp |
429 | * @q_vector: structure containing interrupt and ring information | 497 | * @q_vector: structure containing interrupt and ring information |
430 | * @skb: particular skb to send timestamp with | 498 | * @skb: particular skb to send timestamp with |
@@ -473,6 +541,7 @@ void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector, | |||
473 | /** | 541 | /** |
474 | * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp | 542 | * ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp |
475 | * @q_vector: structure containing interrupt and ring information | 543 | * @q_vector: structure containing interrupt and ring information |
544 | * @rx_desc: the rx descriptor | ||
476 | * @skb: particular skb to send timestamp with | 545 | * @skb: particular skb to send timestamp with |
477 | * | 546 | * |
478 | * if the timestamp is valid, we convert it into the timecounter ns | 547 | * if the timestamp is valid, we convert it into the timecounter ns |
@@ -480,6 +549,7 @@ void ixgbe_ptp_tx_hwtstamp(struct ixgbe_q_vector *q_vector, | |||
480 | * is passed up the network stack | 549 | * is passed up the network stack |
481 | */ | 550 | */ |
482 | void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | 551 | void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, |
552 | union ixgbe_adv_rx_desc *rx_desc, | ||
483 | struct sk_buff *skb) | 553 | struct sk_buff *skb) |
484 | { | 554 | { |
485 | struct ixgbe_adapter *adapter; | 555 | struct ixgbe_adapter *adapter; |
@@ -497,21 +567,33 @@ void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | |||
497 | hw = &adapter->hw; | 567 | hw = &adapter->hw; |
498 | 568 | ||
499 | tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); | 569 | tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); |
570 | |||
571 | /* Check if we have a valid timestamp and make sure the skb should | ||
572 | * have been timestamped */ | ||
573 | if (likely(!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID) || | ||
574 | !ixgbe_ptp_match(skb, adapter->rx_hwtstamp_filter))) | ||
575 | return; | ||
576 | |||
577 | /* | ||
578 | * Always read the registers, in order to clear a possible fault | ||
579 | * because of stagnant RX timestamp values for a packet that never | ||
580 | * reached the queue. | ||
581 | */ | ||
500 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); | 582 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPL); |
501 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; | 583 | regval |= (u64)IXGBE_READ_REG(hw, IXGBE_RXSTMPH) << 32; |
502 | 584 | ||
503 | /* | 585 | /* |
504 | * If this bit is set, then the RX registers contain the time stamp. No | 586 | * If the timestamp bit is set in the packet's descriptor, we know the |
505 | * other packet will be time stamped until we read these registers, so | 587 | * timestamp belongs to this packet. No other packet can be |
506 | * read the registers to make them available again. Because only one | 588 | * timestamped until the registers for timestamping have been read. |
507 | * packet can be time stamped at a time, we know that the register | 589 | * Therefor only one packet with this bit can be in the queue at a |
508 | * values must belong to this one here and therefore we don't need to | 590 | * time, and the rx timestamp values that were in the registers belong |
509 | * compare any of the additional attributes stored for it. | 591 | * to this packet. |
510 | * | 592 | * |
511 | * If nothing went wrong, then it should have a skb_shared_tx that we | 593 | * If nothing went wrong, then it should have a skb_shared_tx that we |
512 | * can turn into a skb_shared_hwtstamps. | 594 | * can turn into a skb_shared_hwtstamps. |
513 | */ | 595 | */ |
514 | if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) | 596 | if (unlikely(!ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_TS))) |
515 | return; | 597 | return; |
516 | 598 | ||
517 | spin_lock_irqsave(&adapter->tmreg_lock, flags); | 599 | spin_lock_irqsave(&adapter->tmreg_lock, flags); |
@@ -539,6 +621,11 @@ void ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, | |||
539 | * type has to be specified. Matching the kind of event packet is | 621 | * type has to be specified. Matching the kind of event packet is |
540 | * not supported, with the exception of "all V2 events regardless of | 622 | * not supported, with the exception of "all V2 events regardless of |
541 | * level 2 or 4". | 623 | * level 2 or 4". |
624 | * | ||
625 | * Since hardware always timestamps Path delay packets when timestamping V2 | ||
626 | * packets, regardless of the type specified in the register, only use V2 | ||
627 | * Event mode. This more accurately tells the user what the hardware is going | ||
628 | * to do anyways. | ||
542 | */ | 629 | */ |
543 | int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | 630 | int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, |
544 | struct ifreq *ifr, int cmd) | 631 | struct ifreq *ifr, int cmd) |
@@ -582,41 +669,30 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | |||
582 | tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; | 669 | tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; |
583 | is_l4 = true; | 670 | is_l4 = true; |
584 | break; | 671 | break; |
672 | case HWTSTAMP_FILTER_PTP_V2_EVENT: | ||
673 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: | ||
674 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: | ||
585 | case HWTSTAMP_FILTER_PTP_V2_SYNC: | 675 | case HWTSTAMP_FILTER_PTP_V2_SYNC: |
586 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: | 676 | case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: |
587 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: | 677 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: |
588 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L2_L4_V2; | ||
589 | tsync_rx_mtrl = IXGBE_RXMTRL_V2_SYNC_MSG; | ||
590 | is_l2 = true; | ||
591 | is_l4 = true; | ||
592 | config.rx_filter = HWTSTAMP_FILTER_SOME; | ||
593 | break; | ||
594 | case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: | 678 | case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: |
595 | case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: | 679 | case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: |
596 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: | 680 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: |
597 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L2_L4_V2; | ||
598 | tsync_rx_mtrl = IXGBE_RXMTRL_V2_DELAY_REQ_MSG; | ||
599 | is_l2 = true; | ||
600 | is_l4 = true; | ||
601 | config.rx_filter = HWTSTAMP_FILTER_SOME; | ||
602 | break; | ||
603 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: | ||
604 | case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: | ||
605 | case HWTSTAMP_FILTER_PTP_V2_EVENT: | ||
606 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2; | 681 | tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2; |
607 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; | ||
608 | is_l2 = true; | 682 | is_l2 = true; |
609 | is_l4 = true; | 683 | is_l4 = true; |
684 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; | ||
610 | break; | 685 | break; |
611 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: | 686 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: |
612 | case HWTSTAMP_FILTER_ALL: | 687 | case HWTSTAMP_FILTER_ALL: |
613 | default: | 688 | default: |
614 | /* | 689 | /* |
615 | * register RXMTRL must be set, therefore it is not | 690 | * register RXMTRL must be set in order to do V1 packets, |
616 | * possible to time stamp both V1 Sync and Delay_Req messages | 691 | * therefore it is not possible to time stamp both V1 Sync and |
617 | * and hardware does not support timestamping all packets | 692 | * Delay_Req messages and hardware does not support |
618 | * => return error | 693 | * timestamping all packets => return error |
619 | */ | 694 | */ |
695 | config.rx_filter = HWTSTAMP_FILTER_NONE; | ||
620 | return -ERANGE; | 696 | return -ERANGE; |
621 | } | 697 | } |
622 | 698 | ||
@@ -626,6 +702,9 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, | |||
626 | return 0; | 702 | return 0; |
627 | } | 703 | } |
628 | 704 | ||
705 | /* Store filter value for later use */ | ||
706 | adapter->rx_hwtstamp_filter = config.rx_filter; | ||
707 | |||
629 | /* define ethertype filter for timestamped packets */ | 708 | /* define ethertype filter for timestamped packets */ |
630 | if (is_l2) | 709 | if (is_l2) |
631 | IXGBE_WRITE_REG(hw, IXGBE_ETQF(3), | 710 | IXGBE_WRITE_REG(hw, IXGBE_ETQF(3), |
@@ -861,6 +940,10 @@ void ixgbe_ptp_init(struct ixgbe_adapter *adapter) | |||
861 | return; | 940 | return; |
862 | } | 941 | } |
863 | 942 | ||
943 | /* initialize the ptp filter */ | ||
944 | if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) | ||
945 | e_dev_warn("ptp_filter_init failed\n"); | ||
946 | |||
864 | spin_lock_init(&adapter->tmreg_lock); | 947 | spin_lock_init(&adapter->tmreg_lock); |
865 | 948 | ||
866 | ixgbe_ptp_start_cyclecounter(adapter); | 949 | ixgbe_ptp_start_cyclecounter(adapter); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c index 1d80b1cefa6a..2334fce47018 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
38 | #include <linux/hwmon.h> | 38 | #include <linux/hwmon.h> |
39 | 39 | ||
40 | #ifdef CONFIG_IXGBE_HWMON | ||
41 | /* hwmon callback functions */ | 40 | /* hwmon callback functions */ |
42 | static ssize_t ixgbe_hwmon_show_location(struct device *dev, | 41 | static ssize_t ixgbe_hwmon_show_location(struct device *dev, |
43 | struct device_attribute *attr, | 42 | struct device_attribute *attr, |
@@ -241,5 +240,4 @@ err: | |||
241 | exit: | 240 | exit: |
242 | return rc; | 241 | return rc; |
243 | } | 242 | } |
244 | #endif /* CONFIG_IXGBE_HWMON */ | ||
245 | 243 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index 204848d2448c..1085c0739a3c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
@@ -2419,7 +2419,7 @@ typedef u32 ixgbe_physical_layer; | |||
2419 | */ | 2419 | */ |
2420 | 2420 | ||
2421 | /* BitTimes (BT) conversion */ | 2421 | /* BitTimes (BT) conversion */ |
2422 | #define IXGBE_BT2KB(BT) ((BT + 1023) / (8 * 1024)) | 2422 | #define IXGBE_BT2KB(BT) ((BT + (8 * 1024 - 1)) / (8 * 1024)) |
2423 | #define IXGBE_B2BT(BT) (BT * 8) | 2423 | #define IXGBE_B2BT(BT) (BT * 8) |
2424 | 2424 | ||
2425 | /* Calculate Delay to respond to PFC */ | 2425 | /* Calculate Delay to respond to PFC */ |
@@ -2450,24 +2450,31 @@ typedef u32 ixgbe_physical_layer; | |||
2450 | #define IXGBE_PCI_DELAY 10000 | 2450 | #define IXGBE_PCI_DELAY 10000 |
2451 | 2451 | ||
2452 | /* Calculate X540 delay value in bit times */ | 2452 | /* Calculate X540 delay value in bit times */ |
2453 | #define IXGBE_FILL_RATE (36 / 25) | 2453 | #define IXGBE_DV_X540(_max_frame_link, _max_frame_tc) \ |
2454 | 2454 | ((36 * \ | |
2455 | #define IXGBE_DV_X540(LINK, TC) (IXGBE_FILL_RATE * \ | 2455 | (IXGBE_B2BT(_max_frame_link) + \ |
2456 | (IXGBE_B2BT(LINK) + IXGBE_PFC_D + \ | 2456 | IXGBE_PFC_D + \ |
2457 | (2 * IXGBE_CABLE_DC) + \ | 2457 | (2 * IXGBE_CABLE_DC) + \ |
2458 | (2 * IXGBE_ID_X540) + \ | 2458 | (2 * IXGBE_ID_X540) + \ |
2459 | IXGBE_HD + IXGBE_B2BT(TC))) | 2459 | IXGBE_HD) / 25 + 1) + \ |
2460 | 2 * IXGBE_B2BT(_max_frame_tc)) | ||
2460 | 2461 | ||
2461 | /* Calculate 82599, 82598 delay value in bit times */ | 2462 | /* Calculate 82599, 82598 delay value in bit times */ |
2462 | #define IXGBE_DV(LINK, TC) (IXGBE_FILL_RATE * \ | 2463 | #define IXGBE_DV(_max_frame_link, _max_frame_tc) \ |
2463 | (IXGBE_B2BT(LINK) + IXGBE_PFC_D + \ | 2464 | ((36 * \ |
2464 | (2 * IXGBE_CABLE_DC) + (2 * IXGBE_ID) + \ | 2465 | (IXGBE_B2BT(_max_frame_link) + \ |
2465 | IXGBE_HD + IXGBE_B2BT(TC))) | 2466 | IXGBE_PFC_D + \ |
2467 | (2 * IXGBE_CABLE_DC) + \ | ||
2468 | (2 * IXGBE_ID) + \ | ||
2469 | IXGBE_HD) / 25 + 1) + \ | ||
2470 | 2 * IXGBE_B2BT(_max_frame_tc)) | ||
2466 | 2471 | ||
2467 | /* Calculate low threshold delay values */ | 2472 | /* Calculate low threshold delay values */ |
2468 | #define IXGBE_LOW_DV_X540(TC) (2 * IXGBE_B2BT(TC) + \ | 2473 | #define IXGBE_LOW_DV_X540(_max_frame_tc) \ |
2469 | (IXGBE_FILL_RATE * IXGBE_PCI_DELAY)) | 2474 | (2 * IXGBE_B2BT(_max_frame_tc) + \ |
2470 | #define IXGBE_LOW_DV(TC) (2 * IXGBE_LOW_DV_X540(TC)) | 2475 | (36 * IXGBE_PCI_DELAY / 25) + 1) |
2476 | #define IXGBE_LOW_DV(_max_frame_tc) \ | ||
2477 | (2 * IXGBE_LOW_DV_X540(_max_frame_tc)) | ||
2471 | 2478 | ||
2472 | /* Software ATR hash keys */ | 2479 | /* Software ATR hash keys */ |
2473 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 | 2480 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 |