aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mii.h
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-11-17 09:30:55 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-21 15:27:19 -0500
commit37f07023d30708b5da091fe6d6be9b60783c6d82 (patch)
treee4f576abd841cdeddc6cbdc9da6b083277784295 /include/linux/mii.h
parentb8ffdbd05f8692cdadccd04464271e48b1e8d439 (diff)
net: Change mii to ethtool advertisement function names
This patch implements advice by Ben Hutchings to change the mii side of the function names to look more like the register whose values they convert. New LPA translation functions have been added as well. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r--include/linux/mii.h64
1 files changed, 49 insertions, 15 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 6697b9112014..2783eca629a0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -241,14 +241,14 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
241} 241}
242 242
243/** 243/**
244 * ethtool_adv_to_mii_100bt 244 * ethtool_adv_to_mii_adv_t
245 * @ethadv: the ethtool advertisement settings 245 * @ethadv: the ethtool advertisement settings
246 * 246 *
247 * A small helper function that translates ethtool advertisement 247 * A small helper function that translates ethtool advertisement
248 * settings to phy autonegotiation advertisements for the 248 * settings to phy autonegotiation advertisements for the
249 * MII_ADVERTISE register. 249 * MII_ADVERTISE register.
250 */ 250 */
251static inline u32 ethtool_adv_to_mii_100bt(u32 ethadv) 251static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
252{ 252{
253 u32 result = 0; 253 u32 result = 0;
254 254
@@ -269,13 +269,13 @@ static inline u32 ethtool_adv_to_mii_100bt(u32 ethadv)
269} 269}
270 270
271/** 271/**
272 * mii_adv_to_ethtool_100bt 272 * mii_adv_to_ethtool_adv_t
273 * @adv: value of the MII_ADVERTISE register 273 * @adv: value of the MII_ADVERTISE register
274 * 274 *
275 * A small helper function that translates MII_ADVERTISE bits 275 * A small helper function that translates MII_ADVERTISE bits
276 * to ethtool advertisement settings. 276 * to ethtool advertisement settings.
277 */ 277 */
278static inline u32 mii_adv_to_ethtool_100bt(u32 adv) 278static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
279{ 279{
280 u32 result = 0; 280 u32 result = 0;
281 281
@@ -296,14 +296,14 @@ static inline u32 mii_adv_to_ethtool_100bt(u32 adv)
296} 296}
297 297
298/** 298/**
299 * ethtool_adv_to_mii_1000T 299 * ethtool_adv_to_mii_ctrl1000_t
300 * @ethadv: the ethtool advertisement settings 300 * @ethadv: the ethtool advertisement settings
301 * 301 *
302 * A small helper function that translates ethtool advertisement 302 * A small helper function that translates ethtool advertisement
303 * settings to phy autonegotiation advertisements for the 303 * settings to phy autonegotiation advertisements for the
304 * MII_CTRL1000 register when in 1000T mode. 304 * MII_CTRL1000 register when in 1000T mode.
305 */ 305 */
306static inline u32 ethtool_adv_to_mii_1000T(u32 ethadv) 306static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
307{ 307{
308 u32 result = 0; 308 u32 result = 0;
309 309
@@ -316,14 +316,14 @@ static inline u32 ethtool_adv_to_mii_1000T(u32 ethadv)
316} 316}
317 317
318/** 318/**
319 * mii_adv_to_ethtool_1000T 319 * mii_ctrl1000_to_ethtool_adv_t
320 * @adv: value of the MII_CTRL1000 register 320 * @adv: value of the MII_CTRL1000 register
321 * 321 *
322 * A small helper function that translates MII_CTRL1000 322 * A small helper function that translates MII_CTRL1000
323 * bits, when in 1000Base-T mode, to ethtool 323 * bits, when in 1000Base-T mode, to ethtool
324 * advertisement settings. 324 * advertisement settings.
325 */ 325 */
326static inline u32 mii_adv_to_ethtool_1000T(u32 adv) 326static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
327{ 327{
328 u32 result = 0; 328 u32 result = 0;
329 329
@@ -335,17 +335,33 @@ static inline u32 mii_adv_to_ethtool_1000T(u32 adv)
335 return result; 335 return result;
336} 336}
337 337
338#define mii_lpa_to_ethtool_100bt(lpa) mii_adv_to_ethtool_100bt(lpa) 338/**
339 * mii_lpa_to_ethtool_lpa_t
340 * @adv: value of the MII_LPA register
341 *
342 * A small helper function that translates MII_LPA
343 * bits, when in 1000Base-T mode, to ethtool
344 * LP advertisement settings.
345 */
346static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
347{
348 u32 result = 0;
349
350 if (lpa & LPA_LPACK)
351 result |= ADVERTISED_Autoneg;
352
353 return result | mii_adv_to_ethtool_adv_t(lpa);
354}
339 355
340/** 356/**
341 * mii_lpa_to_ethtool_1000T 357 * mii_stat1000_to_ethtool_lpa_t
342 * @adv: value of the MII_STAT1000 register 358 * @adv: value of the MII_STAT1000 register
343 * 359 *
344 * A small helper function that translates MII_STAT1000 360 * A small helper function that translates MII_STAT1000
345 * bits, when in 1000Base-T mode, to ethtool 361 * bits, when in 1000Base-T mode, to ethtool
346 * advertisement settings. 362 * advertisement settings.
347 */ 363 */
348static inline u32 mii_lpa_to_ethtool_1000T(u32 lpa) 364static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
349{ 365{
350 u32 result = 0; 366 u32 result = 0;
351 367
@@ -358,14 +374,14 @@ static inline u32 mii_lpa_to_ethtool_1000T(u32 lpa)
358} 374}
359 375
360/** 376/**
361 * ethtool_adv_to_mii_1000X 377 * ethtool_adv_to_mii_adv_x
362 * @ethadv: the ethtool advertisement settings 378 * @ethadv: the ethtool advertisement settings
363 * 379 *
364 * A small helper function that translates ethtool advertisement 380 * A small helper function that translates ethtool advertisement
365 * settings to phy autonegotiation advertisements for the 381 * settings to phy autonegotiation advertisements for the
366 * MII_CTRL1000 register when in 1000Base-X mode. 382 * MII_CTRL1000 register when in 1000Base-X mode.
367 */ 383 */
368static inline u32 ethtool_adv_to_mii_1000X(u32 ethadv) 384static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
369{ 385{
370 u32 result = 0; 386 u32 result = 0;
371 387
@@ -382,14 +398,14 @@ static inline u32 ethtool_adv_to_mii_1000X(u32 ethadv)
382} 398}
383 399
384/** 400/**
385 * mii_adv_to_ethtool_1000X 401 * mii_adv_to_ethtool_adv_x
386 * @adv: value of the MII_CTRL1000 register 402 * @adv: value of the MII_CTRL1000 register
387 * 403 *
388 * A small helper function that translates MII_CTRL1000 404 * A small helper function that translates MII_CTRL1000
389 * bits, when in 1000Base-X mode, to ethtool 405 * bits, when in 1000Base-X mode, to ethtool
390 * advertisement settings. 406 * advertisement settings.
391 */ 407 */
392static inline u32 mii_adv_to_ethtool_1000X(u32 adv) 408static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
393{ 409{
394 u32 result = 0; 410 u32 result = 0;
395 411
@@ -406,6 +422,24 @@ static inline u32 mii_adv_to_ethtool_1000X(u32 adv)
406} 422}
407 423
408/** 424/**
425 * mii_lpa_to_ethtool_lpa_x
426 * @adv: value of the MII_LPA register
427 *
428 * A small helper function that translates MII_LPA
429 * bits, when in 1000Base-X mode, to ethtool
430 * LP advertisement settings.
431 */
432static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
433{
434 u32 result = 0;
435
436 if (lpa & LPA_LPACK)
437 result |= ADVERTISED_Autoneg;
438
439 return result | mii_adv_to_ethtool_adv_x(lpa);
440}
441
442/**
409 * mii_advertise_flowctrl - get flow control advertisement flags 443 * mii_advertise_flowctrl - get flow control advertisement flags
410 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) 444 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
411 */ 445 */