diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-04-29 04:20:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-29 20:32:37 -0400 |
commit | 3f926da82f128c68c479247b1771729b9487502a (patch) | |
tree | c55d11e34dc361895a618afa128077176915dc06 /drivers/net/sfc/net_driver.h | |
parent | af2a3eac2fe6a6d8e9fdf6927284b34466a7d808 (diff) |
sfc: Use generic MDIO flow control auto-negotiation functions
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 457e2f1d4b43..5eabede9ac18 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -495,8 +495,8 @@ struct efx_nic; | |||
495 | 495 | ||
496 | /* Pseudo bit-mask flow control field */ | 496 | /* Pseudo bit-mask flow control field */ |
497 | enum efx_fc_type { | 497 | enum efx_fc_type { |
498 | EFX_FC_RX = 1, | 498 | EFX_FC_RX = FLOW_CTRL_RX, |
499 | EFX_FC_TX = 2, | 499 | EFX_FC_TX = FLOW_CTRL_TX, |
500 | EFX_FC_AUTO = 4, | 500 | EFX_FC_AUTO = 4, |
501 | }; | 501 | }; |
502 | 502 | ||
@@ -506,33 +506,15 @@ enum efx_mac_type { | |||
506 | EFX_XMAC = 2, | 506 | EFX_XMAC = 2, |
507 | }; | 507 | }; |
508 | 508 | ||
509 | static inline unsigned int efx_fc_advertise(enum efx_fc_type wanted_fc) | ||
510 | { | ||
511 | unsigned int adv = 0; | ||
512 | if (wanted_fc & EFX_FC_RX) | ||
513 | adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | ||
514 | if (wanted_fc & EFX_FC_TX) | ||
515 | adv ^= ADVERTISE_PAUSE_ASYM; | ||
516 | return adv; | ||
517 | } | ||
518 | |||
519 | static inline enum efx_fc_type efx_fc_resolve(enum efx_fc_type wanted_fc, | 509 | static inline enum efx_fc_type efx_fc_resolve(enum efx_fc_type wanted_fc, |
520 | unsigned int lpa) | 510 | unsigned int lpa) |
521 | { | 511 | { |
522 | unsigned int adv = efx_fc_advertise(wanted_fc); | 512 | BUILD_BUG_ON(EFX_FC_AUTO & (EFX_FC_RX | EFX_FC_TX)); |
523 | 513 | ||
524 | if (!(wanted_fc & EFX_FC_AUTO)) | 514 | if (!(wanted_fc & EFX_FC_AUTO)) |
525 | return wanted_fc; | 515 | return wanted_fc; |
526 | 516 | ||
527 | if (adv & lpa & ADVERTISE_PAUSE_CAP) | 517 | return mii_resolve_flowctrl_fdx(mii_advertise_flowctrl(wanted_fc), lpa); |
528 | return EFX_FC_RX | EFX_FC_TX; | ||
529 | if (adv & lpa & ADVERTISE_PAUSE_ASYM) { | ||
530 | if (adv & ADVERTISE_PAUSE_CAP) | ||
531 | return EFX_FC_RX; | ||
532 | if (lpa & ADVERTISE_PAUSE_CAP) | ||
533 | return EFX_FC_TX; | ||
534 | } | ||
535 | return 0; | ||
536 | } | 518 | } |
537 | 519 | ||
538 | /** | 520 | /** |