Lines Matching refs:dev
24 struct net_device *dev;
30 static bool ocelot_netdevice_dev_check(const struct net_device *dev);
278 if (!a->dev)
281 if (!ocelot_netdevice_dev_check(a->dev)) {
287 other_priv = netdev_priv(a->dev);
405 if (!tc_cls_can_offload_and_chain0(priv->dev, type_data))
478 static int ocelot_setup_tc(struct net_device *dev, enum tc_setup_type type,
481 struct ocelot_port_private *priv = netdev_priv(dev);
492 static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
495 struct ocelot_port_private *priv = netdev_priv(dev);
506 ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr, vid,
512 static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid)
514 struct ocelot_port_private *priv = netdev_priv(dev);
531 ocelot_mact_forget(ocelot, dev->dev_addr, vid);
536 static int ocelot_port_open(struct net_device *dev)
538 struct ocelot_port_private *priv = netdev_priv(dev);
545 static int ocelot_port_stop(struct net_device *dev)
547 struct ocelot_port_private *priv = netdev_priv(dev);
554 static netdev_tx_t ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
556 struct ocelot_port_private *priv = netdev_priv(dev);
582 ocelot_fdma_inject_frame(ocelot, port, rew_op, skb, dev);
655 static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
657 struct ocelot_port_private *priv = netdev_priv(dev);
669 static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
671 struct ocelot_port_private *priv = netdev_priv(dev);
685 static void ocelot_set_rx_mode(struct net_device *dev)
687 struct ocelot_port_private *priv = netdev_priv(dev);
700 __dev_mc_sync(dev, ocelot_mc_sync, ocelot_mc_unsync);
703 static int ocelot_port_set_mac_address(struct net_device *dev, void *p)
705 struct ocelot_port_private *priv = netdev_priv(dev);
714 ocelot_mact_forget(ocelot, dev->dev_addr, OCELOT_STANDALONE_PVID);
716 eth_hw_addr_set(dev, addr->sa_data);
720 static void ocelot_get_stats64(struct net_device *dev,
723 struct ocelot_port_private *priv = netdev_priv(dev);
731 struct net_device *dev,
736 struct ocelot_port_private *priv = netdev_priv(dev);
745 struct net_device *dev,
749 struct ocelot_port_private *priv = netdev_priv(dev);
780 ndm->ndm_ifindex = dump->dev->ifindex;
802 struct net_device *dev,
805 struct ocelot_port_private *priv = netdev_priv(dev);
808 .dev = dev,
823 static int ocelot_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
826 return ocelot_vlan_vid_add(dev, vid, false, false);
829 static int ocelot_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
832 return ocelot_vlan_vid_del(dev, vid);
849 static int ocelot_set_features(struct net_device *dev,
852 netdev_features_t changed = dev->features ^ features;
853 struct ocelot_port_private *priv = netdev_priv(dev);
857 if ((dev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) &&
859 netdev_err(dev,
870 static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
872 struct ocelot_port_private *priv = netdev_priv(dev);
879 if (!phy_has_hwtstamp(dev->phydev) && ocelot->ptp) {
888 return phy_mii_ioctl(dev->phydev, ifr, cmd);
891 static int ocelot_change_mtu(struct net_device *dev, int new_mtu)
893 struct ocelot_port_private *priv = netdev_priv(dev);
898 WRITE_ONCE(dev->mtu, new_mtu);
931 return priv->dev;
935 static bool ocelot_netdevice_dev_check(const struct net_device *dev)
937 return dev->netdev_ops == &ocelot_port_netdev_ops;
940 int ocelot_netdev_to_port(struct net_device *dev)
944 if (!dev || !ocelot_netdevice_dev_check(dev))
947 priv = netdev_priv(dev);
962 static void ocelot_port_get_ethtool_stats(struct net_device *dev,
966 struct ocelot_port_private *priv = netdev_priv(dev);
973 static int ocelot_port_get_sset_count(struct net_device *dev, int sset)
975 struct ocelot_port_private *priv = netdev_priv(dev);
982 static int ocelot_port_get_ts_info(struct net_device *dev,
985 struct ocelot_port_private *priv = netdev_priv(dev);
990 return ethtool_op_get_ts_info(dev, info);
1033 static int ocelot_port_attr_set(struct net_device *dev, const void *ctx,
1037 struct ocelot_port_private *priv = netdev_priv(dev);
1074 static int ocelot_vlan_vid_prepare(struct net_device *dev, u16 vid, bool pvid,
1077 struct ocelot_port_private *priv = netdev_priv(dev);
1085 static int ocelot_port_obj_add_vlan(struct net_device *dev,
1093 ret = ocelot_vlan_vid_prepare(dev, vlan->vid, pvid, untagged, extack);
1097 return ocelot_vlan_vid_add(dev, vlan->vid, pvid, untagged);
1100 static int ocelot_port_obj_add_mdb(struct net_device *dev,
1103 struct ocelot_port_private *priv = netdev_priv(dev);
1111 static int ocelot_port_obj_del_mdb(struct net_device *dev,
1114 struct ocelot_port_private *priv = netdev_priv(dev);
1122 static int ocelot_port_obj_mrp_add(struct net_device *dev,
1125 struct ocelot_port_private *priv = netdev_priv(dev);
1133 static int ocelot_port_obj_mrp_del(struct net_device *dev,
1136 struct ocelot_port_private *priv = netdev_priv(dev);
1145 ocelot_port_obj_mrp_add_ring_role(struct net_device *dev,
1148 struct ocelot_port_private *priv = netdev_priv(dev);
1157 ocelot_port_obj_mrp_del_ring_role(struct net_device *dev,
1160 struct ocelot_port_private *priv = netdev_priv(dev);
1168 static int ocelot_port_obj_add(struct net_device *dev, const void *ctx,
1172 struct ocelot_port_private *priv = netdev_priv(dev);
1180 ret = ocelot_port_obj_add_vlan(dev,
1185 ret = ocelot_port_obj_add_mdb(dev, SWITCHDEV_OBJ_PORT_MDB(obj));
1188 ret = ocelot_port_obj_mrp_add(dev, SWITCHDEV_OBJ_MRP(obj));
1191 ret = ocelot_port_obj_mrp_add_ring_role(dev,
1201 static int ocelot_port_obj_del(struct net_device *dev, const void *ctx,
1204 struct ocelot_port_private *priv = netdev_priv(dev);
1212 ret = ocelot_vlan_vid_del(dev,
1216 ret = ocelot_port_obj_del_mdb(dev, SWITCHDEV_OBJ_PORT_MDB(obj));
1219 ret = ocelot_port_obj_mrp_del(dev, SWITCHDEV_OBJ_MRP(obj));
1222 ret = ocelot_port_obj_mrp_del_ring_role(dev,
1320 static int ocelot_netdevice_bridge_join(struct net_device *dev,
1325 struct ocelot_port_private *priv = netdev_priv(dev);
1338 err = switchdev_bridge_port_offload(brport_dev, dev, priv,
1362 static void ocelot_netdevice_pre_bridge_leave(struct net_device *dev,
1365 struct ocelot_port_private *priv = netdev_priv(dev);
1372 static int ocelot_netdevice_bridge_leave(struct net_device *dev,
1376 struct ocelot_port_private *priv = netdev_priv(dev);
1393 static int ocelot_netdevice_lag_join(struct net_device *dev,
1398 struct ocelot_port_private *priv = netdev_priv(dev);
1414 err = ocelot_netdevice_bridge_join(dev, bond, bridge_dev, extack);
1425 static void ocelot_netdevice_pre_lag_leave(struct net_device *dev,
1434 ocelot_netdevice_pre_bridge_leave(dev, bond);
1437 static int ocelot_netdevice_lag_leave(struct net_device *dev,
1440 struct ocelot_port_private *priv = netdev_priv(dev);
1452 return ocelot_netdevice_bridge_leave(dev, bond, bridge_dev);
1455 static int ocelot_netdevice_changeupper(struct net_device *dev,
1466 err = ocelot_netdevice_bridge_join(dev, brport_dev,
1470 err = ocelot_netdevice_bridge_leave(dev, brport_dev,
1475 err = ocelot_netdevice_lag_join(dev, info->upper_dev,
1478 ocelot_netdevice_lag_leave(dev, info->upper_dev);
1491 ocelot_netdevice_lag_changeupper(struct net_device *dev,
1498 netdev_for_each_lower_dev(dev, lower, iter) {
1502 if (ocelot_port->bond != dev)
1505 err = ocelot_netdevice_changeupper(lower, dev, info);
1514 ocelot_netdevice_prechangeupper(struct net_device *dev,
1519 ocelot_netdevice_pre_bridge_leave(dev, brport_dev);
1522 ocelot_netdevice_pre_lag_leave(dev, info->upper_dev);
1528 ocelot_netdevice_lag_prechangeupper(struct net_device *dev,
1535 netdev_for_each_lower_dev(dev, lower, iter) {
1539 if (ocelot_port->bond != dev)
1542 err = ocelot_netdevice_prechangeupper(dev, lower, info);
1551 ocelot_netdevice_changelowerstate(struct net_device *dev,
1554 struct ocelot_port_private *priv = netdev_priv(dev);
1574 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1580 if (ocelot_netdevice_dev_check(dev))
1581 return ocelot_netdevice_prechangeupper(dev, dev, info);
1583 if (netif_is_lag_master(dev))
1584 return ocelot_netdevice_lag_prechangeupper(dev, info);
1591 if (ocelot_netdevice_dev_check(dev))
1592 return ocelot_netdevice_changeupper(dev, dev, info);
1594 if (netif_is_lag_master(dev))
1595 return ocelot_netdevice_lag_changeupper(dev, info);
1602 if (!ocelot_netdevice_dev_check(dev))
1605 return ocelot_netdevice_changelowerstate(dev,
1622 struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
1627 err = switchdev_handle_port_attr_set(dev, ptr,
1643 struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
1649 err = switchdev_handle_port_obj_add(dev, ptr,
1654 err = switchdev_handle_port_obj_del(dev, ptr,
1659 err = switchdev_handle_port_attr_set(dev, ptr,
1676 struct net_device *ndev = to_net_dev(config->dev);
1688 struct net_device *ndev = to_net_dev(config->dev);
1704 struct net_device *ndev = to_net_dev(config->dev);
1725 struct device *dev = ocelot->dev;
1740 dev_err(dev, "unsupported phy mode %s for port %d\n",
1753 priv->phylink_config.dev = &priv->dev->dev;
1766 dev_err(dev, "Could not create phylink (%pe)\n", phylink);
1774 dev_err(dev, "Could not connect to PHY: %pe\n", ERR_PTR(err));
1788 struct net_device *dev;
1791 dev = alloc_etherdev(sizeof(struct ocelot_port_private));
1792 if (!dev)
1794 SET_NETDEV_DEV(dev, ocelot->dev);
1795 priv = netdev_priv(dev);
1796 priv->dev = dev;
1803 dev->netdev_ops = &ocelot_port_netdev_ops;
1804 dev->ethtool_ops = &ocelot_ethtool_ops;
1805 dev->max_mtu = OCELOT_JUMBO_MTU;
1807 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS |
1809 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
1811 err = of_get_ethdev_address(portnp, dev);
1813 eth_hw_addr_gen(dev, ocelot->base_mac, port);
1815 ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
1825 ocelot_fdma_netdev_init(ocelot, dev);
1827 SET_NETDEV_DEVLINK_PORT(dev, &ocelot->devlink_ports[port]);
1828 err = register_netdev(dev);
1830 dev_err(ocelot->dev, "register_netdev failed\n");
1838 ocelot_fdma_netdev_deinit(ocelot, dev);
1841 free_netdev(dev);
1854 unregister_netdev(priv->dev);
1857 ocelot_fdma_netdev_deinit(ocelot, priv->dev);
1867 free_netdev(priv->dev);