• Home
  • Raw
  • Download

Lines Matching +full:1000 +full:base +full:- +full:x

1 // SPDX-License-Identifier: GPL-2.0-only
20 * struct sfp_bus - internal representation of a sfp bus
50 /* Ubiquiti U-Fiber Instant module claims that support all transceiver in sfp_quirk_ubnt_uf_instant()
52 * modes and set only one mode which module supports: 1000baseX_Full. in sfp_quirk_ubnt_uf_instant()
55 phylink_set(modes, 1000baseX_Full); in sfp_quirk_ubnt_uf_instant()
60 // Alcatel Lucent G-010S-P can operate at 2500base-X, but
66 // Alcatel Lucent G-010S-A can operate at 2500base-X, but
72 // Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
79 .part = "UF-INSTANT",
111 vs = sfp_strlen(id->base.vendor_name, ARRAY_SIZE(id->base.vendor_name)); in sfp_lookup_quirk()
112 ps = sfp_strlen(id->base.vendor_pn, ARRAY_SIZE(id->base.vendor_pn)); in sfp_lookup_quirk()
115 if (sfp_match(q->vendor, id->base.vendor_name, vs) && in sfp_lookup_quirk()
116 sfp_match(q->part, id->base.vendor_pn, ps)) in sfp_lookup_quirk()
123 * sfp_parse_port() - Parse the EEPROM base ID, setting the port type
130 * %PORT_TP, %PORT_FIBRE or %PORT_OTHER. If @support is non-%NULL,
142 switch (id->base.connector) { in sfp_parse_port()
163 if (id->base.e1000_base_t) { in sfp_parse_port()
175 dev_warn(bus->sfp_dev, "SFP: unknown connector id 0x%02x\n", in sfp_parse_port()
176 id->base.connector); in sfp_parse_port()
198 * sfp_may_have_phy() - indicate whether the module may have a PHY
207 if (id->base.e1000_base_t) in sfp_may_have_phy()
210 if (id->base.phys_id != SFF8024_ID_DWDM_SFP) { in sfp_may_have_phy()
211 switch (id->base.extended_cc) { in sfp_may_have_phy()
225 * sfp_parse_support() - Parse the eeprom id for supported link modes
241 if (id->base.br_nominal) { in sfp_parse_support()
242 if (id->base.br_nominal != 255) { in sfp_parse_support()
243 br_nom = id->base.br_nominal * 100; in sfp_parse_support()
244 br_min = br_nom - id->base.br_nominal * id->ext.br_min; in sfp_parse_support()
245 br_max = br_nom + id->base.br_nominal * id->ext.br_max; in sfp_parse_support()
246 } else if (id->ext.br_max) { in sfp_parse_support()
247 br_nom = 250 * id->ext.br_max; in sfp_parse_support()
248 br_max = br_nom + br_nom * id->ext.br_min / 100; in sfp_parse_support()
249 br_min = br_nom - br_nom * id->ext.br_min / 100; in sfp_parse_support()
256 if (br_min == br_max && id->base.sfp_ct_passive) in sfp_parse_support()
261 if (id->base.e10g_base_sr) in sfp_parse_support()
263 if (id->base.e10g_base_lr) in sfp_parse_support()
265 if (id->base.e10g_base_lrm) in sfp_parse_support()
267 if (id->base.e10g_base_er) in sfp_parse_support()
269 if (id->base.e1000_base_sx || in sfp_parse_support()
270 id->base.e1000_base_lx || in sfp_parse_support()
271 id->base.e1000_base_cx) in sfp_parse_support()
272 phylink_set(modes, 1000baseX_Full); in sfp_parse_support()
273 if (id->base.e1000_base_t) { in sfp_parse_support()
274 phylink_set(modes, 1000baseT_Half); in sfp_parse_support()
275 phylink_set(modes, 1000baseT_Full); in sfp_parse_support()
278 /* 1000Base-PX or 1000Base-BX10 */ in sfp_parse_support()
279 if ((id->base.e_base_px || id->base.e_base_bx10) && in sfp_parse_support()
281 phylink_set(modes, 1000baseX_Full); in sfp_parse_support()
286 if ((id->base.sfp_ct_passive || id->base.sfp_ct_active) && br_nom) { in sfp_parse_support()
293 phylink_set(modes, 1000baseX_Full); in sfp_parse_support()
295 if (id->base.sfp_ct_passive) { in sfp_parse_support()
296 if (id->base.passive.sff8431_app_e) in sfp_parse_support()
299 if (id->base.sfp_ct_active) { in sfp_parse_support()
300 if (id->base.active.sff8431_app_e || in sfp_parse_support()
301 id->base.active.sff8431_lim) { in sfp_parse_support()
306 switch (id->base.extended_cc) { in sfp_parse_support()
335 dev_warn(bus->sfp_dev, in sfp_parse_support()
336 "Unknown/unsupported extended compliance code: 0x%02x\n", in sfp_parse_support()
337 id->base.extended_cc); in sfp_parse_support()
342 if (id->base.fc_speed_100 || in sfp_parse_support()
343 id->base.fc_speed_200 || in sfp_parse_support()
344 id->base.fc_speed_400) { in sfp_parse_support()
345 if (id->base.br_nominal >= 31) in sfp_parse_support()
347 if (id->base.br_nominal >= 12) in sfp_parse_support()
348 phylink_set(modes, 1000baseX_Full); in sfp_parse_support()
353 * 1310nm/1550nm) are not 1000BASE-BX compliant due to the differing in sfp_parse_support()
357 /* If the bit rate allows 1000baseX */ in sfp_parse_support()
359 phylink_set(modes, 1000baseX_Full); in sfp_parse_support()
362 if (bus->sfp_quirk) in sfp_parse_support()
363 bus->sfp_quirk->modes(id, modes); in sfp_parse_support()
374 * sfp_select_interface() - Select appropriate phy_interface_t mode
395 if (phylink_test(link_modes, 1000baseT_Half) || in sfp_select_interface()
396 phylink_test(link_modes, 1000baseT_Full)) in sfp_select_interface()
399 if (phylink_test(link_modes, 1000baseX_Full)) in sfp_select_interface()
402 dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n"); in sfp_select_interface()
413 return bus->registered ? bus->upstream_ops : NULL; in sfp_get_upstream_ops()
425 if (sfp->fwnode == fwnode) { in sfp_bus_get()
426 kref_get(&sfp->kref); in sfp_bus_get()
433 kref_init(&new->kref); in sfp_bus_get()
434 new->fwnode = fwnode; in sfp_bus_get()
435 list_add(&new->node, &sfp_buses); in sfp_bus_get()
451 list_del(&bus->node); in sfp_bus_release()
457 * sfp_bus_put() - put a reference on the &struct sfp_bus
466 kref_put_mutex(&bus->kref, sfp_bus_release, &sfp_mutex); in sfp_bus_put()
472 const struct sfp_upstream_ops *ops = bus->upstream_ops; in sfp_register_bus()
476 if (ops->link_down) in sfp_register_bus()
477 ops->link_down(bus->upstream); in sfp_register_bus()
478 if (ops->connect_phy && bus->phydev) { in sfp_register_bus()
479 ret = ops->connect_phy(bus->upstream, bus->phydev); in sfp_register_bus()
484 bus->registered = true; in sfp_register_bus()
485 bus->socket_ops->attach(bus->sfp); in sfp_register_bus()
486 if (bus->started) in sfp_register_bus()
487 bus->socket_ops->start(bus->sfp); in sfp_register_bus()
488 bus->upstream_ops->attach(bus->upstream, bus); in sfp_register_bus()
494 const struct sfp_upstream_ops *ops = bus->upstream_ops; in sfp_unregister_bus()
496 if (bus->registered) { in sfp_unregister_bus()
497 bus->upstream_ops->detach(bus->upstream, bus); in sfp_unregister_bus()
498 if (bus->started) in sfp_unregister_bus()
499 bus->socket_ops->stop(bus->sfp); in sfp_unregister_bus()
500 bus->socket_ops->detach(bus->sfp); in sfp_unregister_bus()
501 if (bus->phydev && ops && ops->disconnect_phy) in sfp_unregister_bus()
502 ops->disconnect_phy(bus->upstream); in sfp_unregister_bus()
504 bus->registered = false; in sfp_unregister_bus()
508 * sfp_get_module_info() - Get the ethtool_modinfo for a SFP module
519 return bus->socket_ops->module_info(bus->sfp, modinfo); in sfp_get_module_info()
524 * sfp_get_module_eeprom() - Read the SFP module EEPROM
527 * @data: buffer to contain the EEPROM data (must be at least @ee->len bytes)
537 return bus->socket_ops->module_eeprom(bus->sfp, ee, data); in sfp_get_module_eeprom()
542 * sfp_upstream_start() - Inform the SFP that the network device is up
552 if (bus->registered) in sfp_upstream_start()
553 bus->socket_ops->start(bus->sfp); in sfp_upstream_start()
554 bus->started = true; in sfp_upstream_start()
559 * sfp_upstream_stop() - Inform the SFP that the network device is down
569 if (bus->registered) in sfp_upstream_stop()
570 bus->socket_ops->stop(bus->sfp); in sfp_upstream_stop()
571 bus->started = false; in sfp_upstream_stop()
577 bus->upstream_ops = NULL; in sfp_upstream_clear()
578 bus->upstream = NULL; in sfp_upstream_clear()
582 * sfp_bus_find_fwnode() - parse and locate the SFP bus from fwnode
590 * - on success, a pointer to the sfp_bus structure,
591 * - %NULL if no SFP is specified,
592 * - on failure, an error pointer value:
594 * - corresponding to the errors detailed for
596 * - %-ENOMEM if we failed to allocate the bus.
597 * - an error from the upstream's connect_phy() method.
607 if (ret == -ENOENT) in sfp_bus_find_fwnode()
620 return ERR_PTR(-ENOMEM); in sfp_bus_find_fwnode()
627 * sfp_bus_add_upstream() - parse and register the neighbouring device
637 * - on success, a pointer to the sfp_bus structure,
638 * - %NULL if no SFP is specified,
639 * - on failure, an error pointer value:
641 * - corresponding to the errors detailed for
643 * - %-ENOMEM if we failed to allocate the bus.
644 * - an error from the upstream's connect_phy() method.
656 kref_get(&bus->kref); in sfp_bus_add_upstream()
657 bus->upstream_ops = ops; in sfp_bus_add_upstream()
658 bus->upstream = upstream; in sfp_bus_add_upstream()
660 if (bus->sfp) { in sfp_bus_add_upstream()
677 * sfp_bus_del_upstream() - Delete a sfp bus
687 if (bus->sfp) in sfp_bus_del_upstream()
703 if (ops && ops->connect_phy) in sfp_add_phy()
704 ret = ops->connect_phy(bus->upstream, phydev); in sfp_add_phy()
707 bus->phydev = phydev; in sfp_add_phy()
717 if (ops && ops->disconnect_phy) in sfp_remove_phy()
718 ops->disconnect_phy(bus->upstream); in sfp_remove_phy()
719 bus->phydev = NULL; in sfp_remove_phy()
727 if (ops && ops->link_up) in sfp_link_up()
728 ops->link_up(bus->upstream); in sfp_link_up()
736 if (ops && ops->link_down) in sfp_link_down()
737 ops->link_down(bus->upstream); in sfp_link_down()
746 bus->sfp_quirk = sfp_lookup_quirk(id); in sfp_module_insert()
748 if (ops && ops->module_insert) in sfp_module_insert()
749 ret = ops->module_insert(bus->upstream, id); in sfp_module_insert()
759 if (ops && ops->module_remove) in sfp_module_remove()
760 ops->module_remove(bus->upstream); in sfp_module_remove()
762 bus->sfp_quirk = NULL; in sfp_module_remove()
771 if (ops && ops->module_start) in sfp_module_start()
772 ret = ops->module_start(bus->upstream); in sfp_module_start()
782 if (ops && ops->module_stop) in sfp_module_stop()
783 ops->module_stop(bus->upstream); in sfp_module_stop()
789 bus->sfp_dev = NULL; in sfp_socket_clear()
790 bus->sfp = NULL; in sfp_socket_clear()
791 bus->socket_ops = NULL; in sfp_socket_clear()
797 struct sfp_bus *bus = sfp_bus_get(dev->fwnode); in sfp_register_socket()
802 bus->sfp_dev = dev; in sfp_register_socket()
803 bus->sfp = sfp; in sfp_register_socket()
804 bus->socket_ops = ops; in sfp_register_socket()
806 if (bus->upstream_ops) { in sfp_register_socket()
826 if (bus->upstream_ops) in sfp_unregister_socket()