Lines Matching refs:mac

5 #include "dpaa2-mac.h"
78 static bool dpaa2_mac_phy_mode_mismatch(struct dpaa2_mac *mac,
90 return (interface != mac->if_mode);
100 struct dpaa2_mac *mac = phylink_to_dpaa2_mac(config);
104 dpaa2_mac_phy_mode_mismatch(mac, state->interface)) {
149 struct dpaa2_mac *mac = phylink_to_dpaa2_mac(config);
150 struct dpmac_link_state *dpmac_state = &mac->state;
158 err = dpmac_set_link_state(mac->mc_io, 0,
159 mac->mc_dev->mc_handle, dpmac_state);
161 netdev_err(mac->net_dev, "%s: dpmac_set_link_state() = %d\n",
171 struct dpaa2_mac *mac = phylink_to_dpaa2_mac(config);
172 struct dpmac_link_state *dpmac_state = &mac->state;
177 if (mac->if_link_type == DPMAC_LINK_TYPE_PHY) {
202 err = dpmac_set_link_state(mac->mc_io, 0,
203 mac->mc_dev->mc_handle, dpmac_state);
205 netdev_err(mac->net_dev, "%s: dpmac_set_link_state() = %d\n",
213 struct dpaa2_mac *mac = phylink_to_dpaa2_mac(config);
214 struct dpmac_link_state *dpmac_state = &mac->state;
218 err = dpmac_set_link_state(mac->mc_io, 0,
219 mac->mc_dev->mc_handle, dpmac_state);
221 netdev_err(mac->net_dev, "dpmac_set_link_state() = %d\n", err);
257 static int dpaa2_pcs_create(struct dpaa2_mac *mac,
266 netdev_warn(mac->net_dev, "pcs-handle node not found\n");
271 netdev_err(mac->net_dev, "pcs-handle node not available\n");
281 mac->pcs = lynx_pcs_create(mdiodev);
282 if (!mac->pcs) {
283 netdev_err(mac->net_dev, "lynx_pcs_create() failed\n");
291 static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
293 struct lynx_pcs *pcs = mac->pcs;
299 mac->pcs = NULL;
303 int dpaa2_mac_connect(struct dpaa2_mac *mac)
305 struct fsl_mc_device *dpmac_dev = mac->mc_dev;
306 struct net_device *net_dev = mac->net_dev;
312 err = dpmac_open(mac->mc_io, 0, dpmac_dev->obj_desc.id,
319 err = dpmac_get_attributes(mac->mc_io, 0, dpmac_dev->mc_handle, &attr);
325 mac->if_link_type = attr.link_type;
339 mac->if_mode = err;
346 (mac->if_mode == PHY_INTERFACE_MODE_RGMII_ID ||
347 mac->if_mode == PHY_INTERFACE_MODE_RGMII_RXID ||
348 mac->if_mode == PHY_INTERFACE_MODE_RGMII_TXID)) {
356 err = dpaa2_pcs_create(mac, dpmac_node, attr.id);
361 mac->phylink_config.dev = &net_dev->dev;
362 mac->phylink_config.type = PHYLINK_NETDEV;
364 phylink = phylink_create(&mac->phylink_config,
365 of_fwnode_handle(dpmac_node), mac->if_mode,
371 mac->phylink = phylink;
373 if (mac->pcs)
374 phylink_set_pcs(mac->phylink, &mac->pcs->pcs);
376 err = phylink_of_phy_connect(mac->phylink, dpmac_node, 0);
387 phylink_destroy(mac->phylink);
389 dpaa2_pcs_destroy(mac);
393 dpmac_close(mac->mc_io, 0, dpmac_dev->mc_handle);
397 void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
399 if (!mac->phylink)
402 phylink_disconnect_phy(mac->phylink);
403 phylink_destroy(mac->phylink);
404 dpaa2_pcs_destroy(mac);
406 dpmac_close(mac->mc_io, 0, mac->mc_dev->mc_handle);
410 [DPMAC_CNT_ING_ALL_FRAME] = "[mac] rx all frames",
411 [DPMAC_CNT_ING_GOOD_FRAME] = "[mac] rx frames ok",
412 [DPMAC_CNT_ING_ERR_FRAME] = "[mac] rx frame errors",
413 [DPMAC_CNT_ING_FRAME_DISCARD] = "[mac] rx frame discards",
414 [DPMAC_CNT_ING_UCAST_FRAME] = "[mac] rx u-cast",
415 [DPMAC_CNT_ING_BCAST_FRAME] = "[mac] rx b-cast",
416 [DPMAC_CNT_ING_MCAST_FRAME] = "[mac] rx m-cast",
417 [DPMAC_CNT_ING_FRAME_64] = "[mac] rx 64 bytes",
418 [DPMAC_CNT_ING_FRAME_127] = "[mac] rx 65-127 bytes",
419 [DPMAC_CNT_ING_FRAME_255] = "[mac] rx 128-255 bytes",
420 [DPMAC_CNT_ING_FRAME_511] = "[mac] rx 256-511 bytes",
421 [DPMAC_CNT_ING_FRAME_1023] = "[mac] rx 512-1023 bytes",
422 [DPMAC_CNT_ING_FRAME_1518] = "[mac] rx 1024-1518 bytes",
423 [DPMAC_CNT_ING_FRAME_1519_MAX] = "[mac] rx 1519-max bytes",
424 [DPMAC_CNT_ING_FRAG] = "[mac] rx frags",
425 [DPMAC_CNT_ING_JABBER] = "[mac] rx jabber",
426 [DPMAC_CNT_ING_ALIGN_ERR] = "[mac] rx align errors",
427 [DPMAC_CNT_ING_OVERSIZED] = "[mac] rx oversized",
428 [DPMAC_CNT_ING_VALID_PAUSE_FRAME] = "[mac] rx pause",
429 [DPMAC_CNT_ING_BYTE] = "[mac] rx bytes",
430 [DPMAC_CNT_EGR_GOOD_FRAME] = "[mac] tx frames ok",
431 [DPMAC_CNT_EGR_UCAST_FRAME] = "[mac] tx u-cast",
432 [DPMAC_CNT_EGR_MCAST_FRAME] = "[mac] tx m-cast",
433 [DPMAC_CNT_EGR_BCAST_FRAME] = "[mac] tx b-cast",
434 [DPMAC_CNT_EGR_ERR_FRAME] = "[mac] tx frame errors",
435 [DPMAC_CNT_EGR_UNDERSIZED] = "[mac] tx undersized",
436 [DPMAC_CNT_EGR_VALID_PAUSE_FRAME] = "[mac] tx b-pause",
437 [DPMAC_CNT_EGR_BYTE] = "[mac] tx bytes",
458 void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data)
460 struct fsl_mc_device *dpmac_dev = mac->mc_dev;
465 err = dpmac_get_counter(mac->mc_io, 0, dpmac_dev->mc_handle,
468 netdev_err_once(mac->net_dev,