Lines Matching defs:mdev

77 	if (!mlx4_is_slave(priv->mdev->dev)) {
94 struct mlx4_en_dev *mdev = priv->mdev;
105 mutex_lock(&mdev->state_lock);
139 mutex_unlock(&mdev->state_lock);
259 rc = mlx4_flow_detach(priv->mdev->dev, filter->reg_id);
264 rc = mlx4_flow_attach(priv->mdev->dev, &rule, &filter->reg_id);
330 rc = mlx4_flow_detach(priv->mdev->dev, filter->reg_id);
415 queue_work(priv->mdev->workqueue, &filter->work);
481 struct mlx4_en_dev *mdev = priv->mdev;
490 mutex_lock(&mdev->state_lock);
491 if (mdev->device_up && priv->port_up) {
492 err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
498 err = mlx4_register_vlan(mdev->dev, priv->port, vid, &idx);
503 mutex_unlock(&mdev->state_lock);
511 struct mlx4_en_dev *mdev = priv->mdev;
519 mutex_lock(&mdev->state_lock);
520 mlx4_unregister_vlan(mdev->dev, priv->port, vid);
522 if (mdev->device_up && priv->port_up) {
523 err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
527 mutex_unlock(&mdev->state_lock);
547 if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN ||
548 priv->mdev->dev->caps.dmfs_high_steer_mode == MLX4_STEERING_DMFS_A0_STATIC)
551 err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn,
565 struct mlx4_en_dev *mdev = priv->mdev;
566 struct mlx4_dev *dev = mdev->dev;
618 struct mlx4_en_dev *mdev = priv->mdev;
619 struct mlx4_dev *dev = mdev->dev;
644 struct mlx4_en_dev *mdev = priv->mdev;
645 struct mlx4_dev *dev = mdev->dev;
683 struct mlx4_en_dev *mdev = priv->mdev;
684 struct mlx4_dev *dev = mdev->dev;
703 struct mlx4_en_dev *mdev = priv->mdev;
704 struct mlx4_dev *dev = mdev->dev;
736 mlx4_flow_detach(priv->mdev->dev, priv->tunnel_reg_id);
753 struct mlx4_en_dev *mdev = priv->mdev;
756 if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_USER_MAC_EN))
759 err = mlx4_SET_PORT_user_mac(mdev->dev, priv->port, new_mac);
788 struct mlx4_en_dev *mdev = priv->mdev;
796 mutex_lock(&mdev->state_lock);
805 mutex_unlock(&mdev->state_lock);
893 queue_work(priv->mdev->workqueue, &priv->rx_mode_task);
897 struct mlx4_en_dev *mdev)
907 switch (mdev->dev->caps.steering_mode) {
909 err = mlx4_flow_steer_promisc_add(mdev->dev,
919 err = mlx4_unicast_promisc_add(mdev->dev,
929 err = mlx4_multicast_promisc_add(mdev->dev,
939 err = mlx4_SET_PORT_qpn_calc(mdev->dev,
949 err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
957 struct mlx4_en_dev *mdev)
966 switch (mdev->dev->caps.steering_mode) {
968 err = mlx4_flow_steer_promisc_remove(mdev->dev,
977 err = mlx4_unicast_promisc_remove(mdev->dev,
984 err = mlx4_multicast_promisc_remove(mdev->dev,
994 err = mlx4_SET_PORT_qpn_calc(mdev->dev,
1005 struct mlx4_en_dev *mdev)
1014 err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
1021 switch (mdev->dev->caps.steering_mode) {
1023 err = mlx4_flow_steer_promisc_add(mdev->dev,
1030 err = mlx4_multicast_promisc_add(mdev->dev,
1045 switch (mdev->dev->caps.steering_mode) {
1047 err = mlx4_flow_steer_promisc_remove(mdev->dev,
1053 err = mlx4_multicast_promisc_remove(mdev->dev,
1066 err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
1072 mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, ETH_BCAST,
1083 mlx4_SET_MCAST_FLTR(mdev->dev, priv->port,
1086 err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0,
1097 err = mlx4_multicast_detach(mdev->dev,
1106 err = mlx4_flow_detach(priv->mdev->dev, mclist->tunnel_reg_id);
1119 err = mlx4_multicast_attach(mdev->dev,
1139 struct mlx4_en_dev *mdev)
1153 * since all modification code is protected by mdev->state_lock
1179 mlx4_unregister_mac(mdev->dev, priv->port, mac);
1220 err = mlx4_register_mac(mdev->dev, priv->port, mac);
1234 mlx4_unregister_mac(mdev->dev, priv->port, mac);
1262 struct mlx4_en_dev *mdev = priv->mdev;
1265 mutex_lock(&mdev->state_lock);
1266 if (!mdev->device_up) {
1276 if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {
1285 mlx4_en_do_uc_filter(priv, dev, mdev);
1290 mlx4_en_set_promisc_mode(priv, mdev);
1296 mlx4_en_clear_promisc_mode(priv, mdev);
1298 mlx4_en_do_multicast(priv, dev, mdev);
1300 mutex_unlock(&mdev->state_lock);
1335 mlx4_flow_detach(priv->mdev->dev, priv->tunnel_reg_id);
1360 mlx4_unregister_mac(priv->mdev->dev, priv->port, mac);
1367 mlx4_flow_detach(priv->mdev->dev, priv->tunnel_reg_id);
1375 struct mlx4_en_dev *mdev = priv->mdev;
1388 queue_work(mdev->workqueue, &priv->restart_task);
1521 struct mlx4_en_dev *mdev = priv->mdev;
1524 mutex_lock(&mdev->state_lock);
1525 if (mdev->device_up) {
1527 err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
1534 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
1536 if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) {
1538 mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0;
1540 mutex_unlock(&mdev->state_lock);
1551 struct mlx4_en_dev *mdev = priv->mdev;
1553 mutex_lock(&mdev->state_lock);
1554 if (mdev->device_up) {
1555 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
1556 mlx4_en_ptp_overflow_check(mdev);
1559 queue_delayed_work(mdev->workqueue, &priv->service_task,
1562 mutex_unlock(&mdev->state_lock);
1568 struct mlx4_en_dev *mdev = priv->mdev;
1572 if (mlx4_en_QUERY_PORT(mdev, priv->port))
1591 struct mlx4_en_dev *mdev = priv->mdev;
1593 mutex_lock(&mdev->state_lock);
1595 mutex_unlock(&mdev->state_lock);
1601 int numa_node = priv->mdev->dev->numa_node;
1631 struct mlx4_en_dev *mdev = priv->mdev;
1705 mdev->mac_removed[priv->port] = 0;
1708 mlx4_get_default_counter_index(mdev->dev, priv->port);
1774 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
1786 err = mlx4_SET_PORT_user_mtu(mdev->dev, priv->port, dev->mtu);
1794 err = mlx4_SET_PORT_qpn_calc(mdev->dev, priv->port, priv->base_qpn, 0);
1800 if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
1801 err = mlx4_SET_PORT_VXLAN(mdev->dev, priv->port, VXLAN_STEER_BY_OUTER_MAC, 1);
1811 err = mlx4_INIT_PORT(mdev->dev, priv->port);
1818 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0 &&
1820 mlx4_warn(mdev, "Failed setting steering rules\n");
1825 if (mlx4_multicast_attach(mdev->dev, priv->rss_map.indir_qp, mc_list,
1828 mlx4_warn(mdev, "Failed Attaching Broadcast\n");
1834 queue_work(mdev->workqueue, &priv->rx_mode_task);
1836 if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)
1890 struct mlx4_en_dev *mdev = priv->mdev;
1902 mlx4_CLOSE_PORT(mdev->dev, priv->port);
1919 priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
1922 if (mdev->dev->caps.steering_mode ==
1926 mlx4_flow_steer_promisc_remove(mdev->dev,
1929 mlx4_flow_steer_promisc_remove(mdev->dev,
1936 mlx4_unicast_promisc_remove(mdev->dev, priv->base_qpn,
1941 mlx4_multicast_promisc_remove(mdev->dev, priv->base_qpn,
1950 mlx4_multicast_detach(mdev->dev, priv->rss_map.indir_qp, mc_list,
1955 mlx4_multicast_detach(mdev->dev, priv->rss_map.indir_qp,
1958 mlx4_flow_detach(mdev->dev, mclist->tunnel_reg_id);
1967 mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG);
1970 if (mdev->dev->caps.steering_mode ==
1975 mlx4_flow_detach(mdev->dev, flow->id);
1995 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
2003 if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN))
2004 mdev->mac_removed[priv->port] = 1;
2022 struct mlx4_en_dev *mdev = priv->mdev;
2028 mutex_lock(&mdev->state_lock);
2034 mutex_unlock(&mdev->state_lock);
2041 struct mlx4_en_dev *mdev = priv->mdev;
2045 if (!mlx4_is_slave(mdev->dev))
2046 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
2082 struct mlx4_en_dev *mdev = priv->mdev;
2085 mutex_lock(&mdev->state_lock);
2087 if (!mdev->device_up) {
2103 mutex_unlock(&mdev->state_lock);
2111 struct mlx4_en_dev *mdev = priv->mdev;
2115 mutex_lock(&mdev->state_lock);
2120 mutex_unlock(&mdev->state_lock);
2190 priv->dev->rx_cpu_rmap = mlx4_get_cpu_rmap(priv->mdev->dev, priv->port);
2229 dst->mdev = src->mdev;
2315 lockdep_is_held(&priv->mdev->state_lock));
2337 struct mlx4_en_dev *mdev = priv->mdev;
2346 mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE);
2351 flush_workqueue(mdev->workqueue);
2353 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
2354 mlx4_en_remove_timestamp(mdev);
2357 mutex_lock(&mdev->state_lock);
2358 mdev->pndev[priv->port] = NULL;
2359 mdev->upper[priv->port] = NULL;
2366 mutex_unlock(&mdev->state_lock);
2387 struct mlx4_en_dev *mdev = priv->mdev;
2400 mutex_lock(&mdev->state_lock);
2401 if (!mdev->device_up) {
2413 queue_work(mdev->workqueue, &priv->restart_task);
2416 mutex_unlock(&mdev->state_lock);
2424 struct mlx4_en_dev *mdev = priv->mdev;
2431 if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS))
2501 struct mlx4_en_dev *mdev = en_priv->mdev;
2508 !(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN))
2534 ret = mlx4_SET_PORT_fcs_check(priv->mdev->dev,
2573 struct mlx4_en_dev *mdev = en_priv->mdev;
2575 return mlx4_set_vf_mac(mdev->dev, en_priv->port, queue, mac);
2582 struct mlx4_en_dev *mdev = en_priv->mdev;
2584 return mlx4_set_vf_vlan(mdev->dev, en_priv->port, vf, vlan, qos,
2592 struct mlx4_en_dev *mdev = en_priv->mdev;
2594 return mlx4_set_vf_rate(mdev->dev, en_priv->port, vf, min_tx_rate,
2601 struct mlx4_en_dev *mdev = en_priv->mdev;
2603 return mlx4_set_vf_spoofchk(mdev->dev, en_priv->port, vf, setting);
2609 struct mlx4_en_dev *mdev = en_priv->mdev;
2611 return mlx4_get_vf_config(mdev->dev, en_priv->port, vf, ivf);
2617 struct mlx4_en_dev *mdev = en_priv->mdev;
2619 return mlx4_set_vf_link_state(mdev->dev, en_priv->port, vf, link_state);
2626 struct mlx4_en_dev *mdev = en_priv->mdev;
2628 return mlx4_get_vf_stats(mdev->dev, en_priv->port, vf, vf_stats);
2636 struct mlx4_dev *mdev = priv->mdev->dev;
2638 u64 phys_port_id = mdev->caps.phys_port_id[priv->port];
2660 ret = mlx4_config_vxlan_port(priv->mdev->dev, priv->vxlan_port);
2664 return mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
2709 if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT))
2724 err = mlx4_update_qp(priv->mdev->dev, tx_ring->qpn, MLX4_UPDATE_QP_RATE_LIMIT,
2732 struct mlx4_en_dev *mdev = priv->mdev;
2751 mutex_lock(&mdev->state_lock);
2755 lockdep_is_held(&mdev->state_lock));
2760 mutex_unlock(&mdev->state_lock);
2774 mutex_lock(&mdev->state_lock);
2804 lockdep_is_held(&mdev->state_lock));
2816 queue_work(mdev->workqueue, &priv->restart_task);
2821 mutex_unlock(&mdev->state_lock);
2904 struct mlx4_en_dev *mdev;
2914 mdev = container_of(this, struct mlx4_en_dev, netdev_nb);
2915 dev = mdev->dev;
2922 if (!port && (mdev->pndev[i] == ndev))
2924 mdev->upper[i] = mdev->pndev[i] ?
2925 netdev_master_upper_dev_get(mdev->pndev[i]) : NULL;
2927 if (!mdev->upper[i])
2932 if (mdev->upper[i] != mdev->upper[i-1])
3102 int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3118 SET_NETDEV_DEV(dev, &mdev->dev->persist->pdev->dev);
3127 priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
3140 priv->mdev = mdev;
3141 priv->ddev = &mdev->pdev->dev;
3149 priv->num_tx_rings_p_up = mdev->profile.max_num_tx_rings_p_up;
3174 priv->cqe_factor = (mdev->dev->caps.cqe_size == 64) ? 1 : 0;
3175 priv->cqe_size = mdev->dev->caps.cqe_size;
3179 if (!mlx4_is_slave(priv->mdev->dev)) {
3195 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) {
3208 priv->max_mtu = mdev->dev->caps.eth_mtu_cap[priv->port];
3210 if (mdev->dev->caps.rx_checksum_flags_port[priv->port] &
3216 mlx4_en_u64_to_mac(dev, mdev->dev->caps.def_mac[priv->port]);
3222 } else if (mlx4_is_slave(priv->mdev->dev) &&
3223 (priv->mdev->dev->port_random_macs & 1 << priv->port)) {
3245 err = mlx4_alloc_hwq_res(mdev->dev, &priv->res,
3256 if (mlx4_is_master(priv->mdev->dev))
3271 if (mdev->LSO_support)
3274 if (mdev->dev->caps.tunnel_offload_mode ==
3302 if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_SKIP_OUTER_VLAN)) {
3308 if (mlx4_is_slave(mdev->dev)) {
3312 err = get_phv_bit(mdev->dev, port, &phv);
3317 err = mlx4_get_is_vlan_offload_disabled(mdev->dev, port,
3330 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PHV_EN &&
3331 !(mdev->dev->caps.flags2 &
3336 if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP)
3339 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_IGNORE_FCS)
3342 if (mdev->dev->caps.steering_mode ==
3344 mdev->dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC)
3347 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
3351 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP) {
3353 } else if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR) {
3370 mdev->pndev[port] = dev;
3371 mdev->upper[port] = NULL;
3383 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
3393 if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
3394 err = mlx4_SET_PORT_VXLAN(mdev->dev, priv->port, VXLAN_STEER_BY_OUTER_MAC, 1);
3404 err = mlx4_INIT_PORT(mdev->dev, priv->port);
3409 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
3412 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
3413 mlx4_en_init_timestamp(mdev);
3415 queue_delayed_work(mdev->workqueue, &priv->service_task,
3418 mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap,
3419 mdev->profile.prof[priv->port].rx_ppp,
3420 mdev->profile.prof[priv->port].rx_pause,
3421 mdev->profile.prof[priv->port].tx_ppp,
3422 mdev->profile.prof[priv->port].tx_pause);
3425 mlx4_get_devlink_port(mdev->dev, priv->port));
3446 struct mlx4_en_dev *mdev = priv->mdev;
3469 mutex_lock(&mdev->state_lock);
3526 mutex_unlock(&mdev->state_lock);