Lines Matching +full:etsec +full:- +full:ptp
1 // SPDX-License-Identifier: GPL-2.0-only
13 * Copyright 2003-2006, 2008-2009, 2011 Freescale Semiconductor, Inc.
53 "rx-allocation-errors",
54 "rx-large-frame-errors",
55 "rx-short-frame-errors",
56 "rx-non-octet-errors",
57 "rx-crc-errors",
58 "rx-overrun-errors",
59 "rx-busy-errors",
60 "rx-babbling-errors",
61 "rx-truncated-frames",
62 "ethernet-bus-error",
63 "tx-babbling-errors",
64 "tx-underrun-errors",
65 "tx-timeout-errors",
67 "tx-rx-64-frames",
68 "tx-rx-65-127-frames",
69 "tx-rx-128-255-frames",
70 "tx-rx-256-511-frames",
71 "tx-rx-512-1023-frames",
72 "tx-rx-1024-1518-frames",
73 "tx-rx-1519-1522-good-vlan",
74 "rx-bytes",
75 "rx-packets",
76 "rx-fcs-errors",
77 "receive-multicast-packet",
78 "receive-broadcast-packet",
79 "rx-control-frame-packets",
80 "rx-pause-frame-packets",
81 "rx-unknown-op-code",
82 "rx-alignment-error",
83 "rx-frame-length-error",
84 "rx-code-error",
85 "rx-carrier-sense-error",
86 "rx-undersize-packets",
87 "rx-oversize-packets",
88 "rx-fragmented-frames",
89 "rx-jabber-frames",
90 "rx-dropped-frames",
91 "tx-byte-counter",
92 "tx-packets",
93 "tx-multicast-packets",
94 "tx-broadcast-packets",
95 "tx-pause-control-frames",
96 "tx-deferral-packets",
97 "tx-excessive-deferral-packets",
98 "tx-single-collision-packets",
99 "tx-multiple-collision-packets",
100 "tx-late-collision-packets",
101 "tx-excessive-collision-packets",
102 "tx-total-collision",
104 "tx-dropped-frames",
105 "tx-jabber-frames",
106 "tx-fcs-errors",
107 "tx-control-frames",
108 "tx-oversize-frames",
109 "tx-undersize-frames",
110 "tx-fragmented-frames",
120 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) in gfar_gstrings()
128 /* Fill in an array of 64-bit statistics from various sources.
137 struct gfar __iomem *regs = priv->gfargrp[0].regs; in gfar_fill_stats()
138 atomic64_t *extra = (atomic64_t *)&priv->extra_stats; in gfar_fill_stats()
143 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { in gfar_fill_stats()
144 u32 __iomem *rmon = (u32 __iomem *) ®s->rmon; in gfar_fill_stats()
157 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON) in gfar_sset_count()
162 return -EOPNOTSUPP; in gfar_sset_count()
170 strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in gfar_gdrvinfo()
185 u32 __iomem *theregs = (u32 __iomem *) priv->gfargrp[0].regs; in gfar_get_regs()
197 struct net_device *ndev = priv->ndev; in gfar_usecs2ticks()
198 struct phy_device *phydev = ndev->phydev; in gfar_usecs2ticks()
202 switch (phydev->speed) { in gfar_usecs2ticks()
224 struct net_device *ndev = priv->ndev; in gfar_ticks2usecs()
225 struct phy_device *phydev = ndev->phydev; in gfar_ticks2usecs()
229 switch (phydev->speed) { in gfar_ticks2usecs()
262 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) in gfar_gcoalesce()
263 return -EOPNOTSUPP; in gfar_gcoalesce()
265 if (!dev->phydev) in gfar_gcoalesce()
266 return -ENODEV; in gfar_gcoalesce()
268 rx_queue = priv->rx_queue[0]; in gfar_gcoalesce()
269 tx_queue = priv->tx_queue[0]; in gfar_gcoalesce()
271 rxtime = get_ictt_value(rx_queue->rxic); in gfar_gcoalesce()
272 rxcount = get_icft_value(rx_queue->rxic); in gfar_gcoalesce()
273 txtime = get_ictt_value(tx_queue->txic); in gfar_gcoalesce()
274 txcount = get_icft_value(tx_queue->txic); in gfar_gcoalesce()
275 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, rxtime); in gfar_gcoalesce()
276 cvals->rx_max_coalesced_frames = rxcount; in gfar_gcoalesce()
278 cvals->tx_coalesce_usecs = gfar_ticks2usecs(priv, txtime); in gfar_gcoalesce()
279 cvals->tx_max_coalesced_frames = txcount; in gfar_gcoalesce()
285 * Both cvals->*_usecs and cvals->*_frames have to be > 0
296 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) in gfar_scoalesce()
297 return -EOPNOTSUPP; in gfar_scoalesce()
299 if (!dev->phydev) in gfar_scoalesce()
300 return -ENODEV; in gfar_scoalesce()
303 if (cvals->rx_coalesce_usecs > GFAR_MAX_COAL_USECS) { in gfar_scoalesce()
306 return -EINVAL; in gfar_scoalesce()
309 if (cvals->rx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { in gfar_scoalesce()
312 return -EINVAL; in gfar_scoalesce()
316 if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) { in gfar_scoalesce()
319 return -EINVAL; in gfar_scoalesce()
322 if (cvals->tx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { in gfar_scoalesce()
325 return -EINVAL; in gfar_scoalesce()
328 while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) in gfar_scoalesce()
332 if ((cvals->rx_coalesce_usecs == 0) || in gfar_scoalesce()
333 (cvals->rx_max_coalesced_frames == 0)) { in gfar_scoalesce()
334 for (i = 0; i < priv->num_rx_queues; i++) in gfar_scoalesce()
335 priv->rx_queue[i]->rxcoalescing = 0; in gfar_scoalesce()
337 for (i = 0; i < priv->num_rx_queues; i++) in gfar_scoalesce()
338 priv->rx_queue[i]->rxcoalescing = 1; in gfar_scoalesce()
341 for (i = 0; i < priv->num_rx_queues; i++) { in gfar_scoalesce()
342 priv->rx_queue[i]->rxic = mk_ic_value( in gfar_scoalesce()
343 cvals->rx_max_coalesced_frames, in gfar_scoalesce()
344 gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs)); in gfar_scoalesce()
348 if ((cvals->tx_coalesce_usecs == 0) || in gfar_scoalesce()
349 (cvals->tx_max_coalesced_frames == 0)) { in gfar_scoalesce()
350 for (i = 0; i < priv->num_tx_queues; i++) in gfar_scoalesce()
351 priv->tx_queue[i]->txcoalescing = 0; in gfar_scoalesce()
353 for (i = 0; i < priv->num_tx_queues; i++) in gfar_scoalesce()
354 priv->tx_queue[i]->txcoalescing = 1; in gfar_scoalesce()
357 for (i = 0; i < priv->num_tx_queues; i++) { in gfar_scoalesce()
358 priv->tx_queue[i]->txic = mk_ic_value( in gfar_scoalesce()
359 cvals->tx_max_coalesced_frames, in gfar_scoalesce()
360 gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs)); in gfar_scoalesce()
363 if (dev->flags & IFF_UP) { in gfar_scoalesce()
370 clear_bit_unlock(GFAR_RESETTING, &priv->state); in gfar_scoalesce()
387 tx_queue = priv->tx_queue[0]; in gfar_gringparam()
388 rx_queue = priv->rx_queue[0]; in gfar_gringparam()
390 rvals->rx_max_pending = GFAR_RX_MAX_RING_SIZE; in gfar_gringparam()
391 rvals->rx_mini_max_pending = GFAR_RX_MAX_RING_SIZE; in gfar_gringparam()
392 rvals->rx_jumbo_max_pending = GFAR_RX_MAX_RING_SIZE; in gfar_gringparam()
393 rvals->tx_max_pending = GFAR_TX_MAX_RING_SIZE; in gfar_gringparam()
398 rvals->rx_pending = rx_queue->rx_ring_size; in gfar_gringparam()
399 rvals->rx_mini_pending = rx_queue->rx_ring_size; in gfar_gringparam()
400 rvals->rx_jumbo_pending = rx_queue->rx_ring_size; in gfar_gringparam()
401 rvals->tx_pending = tx_queue->tx_ring_size; in gfar_gringparam()
415 if (rvals->rx_pending > GFAR_RX_MAX_RING_SIZE) in gfar_sringparam()
416 return -EINVAL; in gfar_sringparam()
418 if (!is_power_of_2(rvals->rx_pending)) { in gfar_sringparam()
420 return -EINVAL; in gfar_sringparam()
423 if (rvals->tx_pending > GFAR_TX_MAX_RING_SIZE) in gfar_sringparam()
424 return -EINVAL; in gfar_sringparam()
426 if (!is_power_of_2(rvals->tx_pending)) { in gfar_sringparam()
428 return -EINVAL; in gfar_sringparam()
431 while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) in gfar_sringparam()
434 if (dev->flags & IFF_UP) in gfar_sringparam()
438 for (i = 0; i < priv->num_rx_queues; i++) in gfar_sringparam()
439 priv->rx_queue[i]->rx_ring_size = rvals->rx_pending; in gfar_sringparam()
441 for (i = 0; i < priv->num_tx_queues; i++) in gfar_sringparam()
442 priv->tx_queue[i]->tx_ring_size = rvals->tx_pending; in gfar_sringparam()
445 if (dev->flags & IFF_UP) in gfar_sringparam()
448 clear_bit_unlock(GFAR_RESETTING, &priv->state); in gfar_sringparam()
458 epause->autoneg = !!priv->pause_aneg_en; in gfar_gpauseparam()
459 epause->rx_pause = !!priv->rx_pause_en; in gfar_gpauseparam()
460 epause->tx_pause = !!priv->tx_pause_en; in gfar_gpauseparam()
467 struct phy_device *phydev = dev->phydev; in gfar_spauseparam()
468 struct gfar __iomem *regs = priv->gfargrp[0].regs; in gfar_spauseparam()
471 return -ENODEV; in gfar_spauseparam()
474 return -EINVAL; in gfar_spauseparam()
476 priv->rx_pause_en = priv->tx_pause_en = 0; in gfar_spauseparam()
477 phy_set_asym_pause(phydev, epause->rx_pause, epause->tx_pause); in gfar_spauseparam()
478 if (epause->rx_pause) { in gfar_spauseparam()
479 priv->rx_pause_en = 1; in gfar_spauseparam()
481 if (epause->tx_pause) { in gfar_spauseparam()
482 priv->tx_pause_en = 1; in gfar_spauseparam()
484 } else if (epause->tx_pause) { in gfar_spauseparam()
485 priv->tx_pause_en = 1; in gfar_spauseparam()
488 if (epause->autoneg) in gfar_spauseparam()
489 priv->pause_aneg_en = 1; in gfar_spauseparam()
491 priv->pause_aneg_en = 0; in gfar_spauseparam()
493 if (!epause->autoneg) { in gfar_spauseparam()
494 u32 tempval = gfar_read(®s->maccfg1); in gfar_spauseparam()
498 priv->tx_actual_en = 0; in gfar_spauseparam()
499 if (priv->tx_pause_en) { in gfar_spauseparam()
500 priv->tx_actual_en = 1; in gfar_spauseparam()
504 if (priv->rx_pause_en) in gfar_spauseparam()
506 gfar_write(®s->maccfg1, tempval); in gfar_spauseparam()
514 netdev_features_t changed = dev->features ^ features; in gfar_set_features()
522 while (test_and_set_bit_lock(GFAR_RESETTING, &priv->state)) in gfar_set_features()
525 dev->features = features; in gfar_set_features()
527 if (dev->flags & IFF_UP) { in gfar_set_features()
535 clear_bit_unlock(GFAR_RESETTING, &priv->state); in gfar_set_features()
544 return priv->msg_enable; in gfar_get_msglevel()
551 priv->msg_enable = data; in gfar_set_msglevel()
559 wol->supported = 0; in gfar_get_wol()
560 wol->wolopts = 0; in gfar_get_wol()
562 if (priv->wol_supported & GFAR_WOL_MAGIC) in gfar_get_wol()
563 wol->supported |= WAKE_MAGIC; in gfar_get_wol()
565 if (priv->wol_supported & GFAR_WOL_FILER_UCAST) in gfar_get_wol()
566 wol->supported |= WAKE_UCAST; in gfar_get_wol()
568 if (priv->wol_opts & GFAR_WOL_MAGIC) in gfar_get_wol()
569 wol->wolopts |= WAKE_MAGIC; in gfar_get_wol()
571 if (priv->wol_opts & GFAR_WOL_FILER_UCAST) in gfar_get_wol()
572 wol->wolopts |= WAKE_UCAST; in gfar_get_wol()
581 if (!priv->wol_supported && wol->wolopts) in gfar_set_wol()
582 return -EINVAL; in gfar_set_wol()
584 if (wol->wolopts & ~(WAKE_MAGIC | WAKE_UCAST)) in gfar_set_wol()
585 return -EINVAL; in gfar_set_wol()
587 if (wol->wolopts & WAKE_MAGIC) { in gfar_set_wol()
590 if (wol->wolopts & WAKE_UCAST) in gfar_set_wol()
594 wol_opts &= priv->wol_supported; in gfar_set_wol()
595 priv->wol_opts = 0; in gfar_set_wol()
597 err = device_set_wakeup_enable(priv->dev, wol_opts); in gfar_set_wol()
601 priv->wol_opts = wol_opts; in gfar_set_wol()
614 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
615 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
616 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
617 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
621 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
622 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
623 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
624 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
630 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
631 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
632 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
633 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
639 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
640 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
641 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
642 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
648 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
649 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
650 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
651 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
657 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
658 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
659 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
660 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
666 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
667 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
668 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
669 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
675 priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; in ethflow_to_filer_rules()
676 priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; in ethflow_to_filer_rules()
677 gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); in ethflow_to_filer_rules()
678 priv->cur_filer_idx = priv->cur_filer_idx - 1; in ethflow_to_filer_rules()
715 netdev_err(priv->ndev, in gfar_ethflow_to_filer_table()
722 local_rqfpr[j] = priv->ftp_rqfpr[i]; in gfar_ethflow_to_filer_table()
723 local_rqfcr[j] = priv->ftp_rqfcr[i]; in gfar_ethflow_to_filer_table()
724 j--; in gfar_ethflow_to_filer_table()
725 if ((priv->ftp_rqfcr[i] == in gfar_ethflow_to_filer_table()
727 (priv->ftp_rqfpr[i] == cmp_rqfpr)) in gfar_ethflow_to_filer_table()
732 netdev_err(priv->ndev, in gfar_ethflow_to_filer_table()
742 if ((priv->ftp_rqfcr[l] & RQFCR_CLE) && in gfar_ethflow_to_filer_table()
743 !(priv->ftp_rqfcr[l] & RQFCR_AND)) { in gfar_ethflow_to_filer_table()
744 priv->ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT | in gfar_ethflow_to_filer_table()
746 priv->ftp_rqfpr[l] = FPR_FILER_MASK; in gfar_ethflow_to_filer_table()
747 gfar_write_filer(priv, l, priv->ftp_rqfcr[l], in gfar_ethflow_to_filer_table()
748 priv->ftp_rqfpr[l]); in gfar_ethflow_to_filer_table()
752 if (!(priv->ftp_rqfcr[l] & RQFCR_CLE) && in gfar_ethflow_to_filer_table()
753 (priv->ftp_rqfcr[l] & RQFCR_AND)) in gfar_ethflow_to_filer_table()
756 local_rqfpr[j] = priv->ftp_rqfpr[l]; in gfar_ethflow_to_filer_table()
757 local_rqfcr[j] = priv->ftp_rqfcr[l]; in gfar_ethflow_to_filer_table()
758 j--; in gfar_ethflow_to_filer_table()
762 priv->cur_filer_idx = l - 1; in gfar_ethflow_to_filer_table()
769 priv->ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k]; in gfar_ethflow_to_filer_table()
770 priv->ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k]; in gfar_ethflow_to_filer_table()
771 gfar_write_filer(priv, priv->cur_filer_idx, in gfar_ethflow_to_filer_table()
773 if (!priv->cur_filer_idx) in gfar_ethflow_to_filer_table()
775 priv->cur_filer_idx = priv->cur_filer_idx - 1; in gfar_ethflow_to_filer_table()
788 if (!gfar_ethflow_to_filer_table(priv, cmd->data, cmd->flow_type)) in gfar_set_hash_opts()
789 return -EINVAL; in gfar_set_hash_opts()
796 struct gfar __iomem *regs = priv->gfargrp[0].regs; in gfar_check_filer_hardware()
800 i = gfar_read(®s->ecntrl); in gfar_check_filer_hardware()
803 netdev_notice(priv->ndev, "Interface in FIFO mode\n"); in gfar_check_filer_hardware()
804 i = gfar_read(®s->rctrl); in gfar_check_filer_hardware()
807 netdev_info(priv->ndev, in gfar_check_filer_hardware()
810 netdev_warn(priv->ndev, in gfar_check_filer_hardware()
812 return -EOPNOTSUPP; in gfar_check_filer_hardware()
817 i = gfar_read(®s->rctrl); in gfar_check_filer_hardware()
820 netdev_info(priv->ndev, in gfar_check_filer_hardware()
823 netdev_warn(priv->ndev, in gfar_check_filer_hardware()
825 return -EOPNOTSUPP; in gfar_check_filer_hardware()
832 gfar_write(®s->rbifx, 0xC0C1C2C3); in gfar_check_filer_hardware()
839 tab->fe[tab->index].ctrl = RQFCR_AND | RQFCR_PID_MASK | RQFCR_CMP_EXACT; in gfar_set_mask()
840 tab->fe[tab->index].prop = mask; in gfar_set_mask()
841 tab->index++; in gfar_set_mask()
848 tab->fe[tab->index].ctrl = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | in gfar_set_parse_bits()
850 tab->fe[tab->index].prop = value; in gfar_set_parse_bits()
851 tab->index++; in gfar_set_parse_bits()
858 tab->fe[tab->index].ctrl = RQFCR_CMP_EXACT | RQFCR_AND | flag; in gfar_set_general_attribute()
859 tab->fe[tab->index].prop = value; in gfar_set_general_attribute()
860 tab->index++; in gfar_set_general_attribute()
865 * IP-Src = 10.0.0.0/255.0.0.0
875 * Further the all masks are one-padded for better hardware efficiency.
939 gfar_set_attribute(be32_to_cpu(value->ip4src), in gfar_set_basic_ip()
940 be32_to_cpu(mask->ip4src), in gfar_set_basic_ip()
942 gfar_set_attribute(be32_to_cpu(value->ip4dst), in gfar_set_basic_ip()
943 be32_to_cpu(mask->ip4dst), in gfar_set_basic_ip()
945 gfar_set_attribute(be16_to_cpu(value->pdst), in gfar_set_basic_ip()
946 be16_to_cpu(mask->pdst), in gfar_set_basic_ip()
948 gfar_set_attribute(be16_to_cpu(value->psrc), in gfar_set_basic_ip()
949 be16_to_cpu(mask->psrc), in gfar_set_basic_ip()
951 gfar_set_attribute(value->tos, mask->tos, RQFCR_PID_TOS, tab); in gfar_set_basic_ip()
954 /* Translates value and mask for RAW-IP4 */
959 gfar_set_attribute(be32_to_cpu(value->ip4src), in gfar_set_user_ip()
960 be32_to_cpu(mask->ip4src), in gfar_set_user_ip()
962 gfar_set_attribute(be32_to_cpu(value->ip4dst), in gfar_set_user_ip()
963 be32_to_cpu(mask->ip4dst), in gfar_set_user_ip()
965 gfar_set_attribute(value->tos, mask->tos, RQFCR_PID_TOS, tab); in gfar_set_user_ip()
966 gfar_set_attribute(value->proto, mask->proto, RQFCR_PID_L4P, tab); in gfar_set_user_ip()
967 gfar_set_attribute(be32_to_cpu(value->l4_4_bytes), in gfar_set_user_ip()
968 be32_to_cpu(mask->l4_4_bytes), in gfar_set_user_ip()
981 if (!is_broadcast_ether_addr(mask->h_source)) { in gfar_set_ether()
982 if (is_zero_ether_addr(mask->h_source)) { in gfar_set_ether()
986 upper_temp_mask = mask->h_source[0] << 16 | in gfar_set_ether()
987 mask->h_source[1] << 8 | in gfar_set_ether()
988 mask->h_source[2]; in gfar_set_ether()
989 lower_temp_mask = mask->h_source[3] << 16 | in gfar_set_ether()
990 mask->h_source[4] << 8 | in gfar_set_ether()
991 mask->h_source[5]; in gfar_set_ether()
994 gfar_set_attribute(value->h_source[0] << 16 | in gfar_set_ether()
995 value->h_source[1] << 8 | in gfar_set_ether()
996 value->h_source[2], in gfar_set_ether()
999 gfar_set_attribute(value->h_source[3] << 16 | in gfar_set_ether()
1000 value->h_source[4] << 8 | in gfar_set_ether()
1001 value->h_source[5], in gfar_set_ether()
1005 if (!is_broadcast_ether_addr(mask->h_dest)) { in gfar_set_ether()
1007 if ((is_broadcast_ether_addr(value->h_dest) && in gfar_set_ether()
1008 is_zero_ether_addr(mask->h_dest))) { in gfar_set_ether()
1011 if (is_zero_ether_addr(mask->h_dest)) { in gfar_set_ether()
1015 upper_temp_mask = mask->h_dest[0] << 16 | in gfar_set_ether()
1016 mask->h_dest[1] << 8 | in gfar_set_ether()
1017 mask->h_dest[2]; in gfar_set_ether()
1018 lower_temp_mask = mask->h_dest[3] << 16 | in gfar_set_ether()
1019 mask->h_dest[4] << 8 | in gfar_set_ether()
1020 mask->h_dest[5]; in gfar_set_ether()
1024 gfar_set_attribute(value->h_dest[0] << 16 | in gfar_set_ether()
1025 value->h_dest[1] << 8 | in gfar_set_ether()
1026 value->h_dest[2], in gfar_set_ether()
1029 gfar_set_attribute(value->h_dest[3] << 16 | in gfar_set_ether()
1030 value->h_dest[4] << 8 | in gfar_set_ether()
1031 value->h_dest[5], in gfar_set_ether()
1036 gfar_set_attribute(be16_to_cpu(value->h_proto), in gfar_set_ether()
1037 be16_to_cpu(mask->h_proto), in gfar_set_ether()
1043 return be16_to_cpu(rule->h_ext.vlan_tci) & VLAN_VID_MASK; in vlan_tci_vid()
1048 return be16_to_cpu(rule->m_ext.vlan_tci) & VLAN_VID_MASK; in vlan_tci_vidm()
1053 return be16_to_cpu(rule->h_ext.vlan_tci) & VLAN_CFI_MASK; in vlan_tci_cfi()
1058 return be16_to_cpu(rule->m_ext.vlan_tci) & VLAN_CFI_MASK; in vlan_tci_cfim()
1063 return (be16_to_cpu(rule->h_ext.vlan_tci) & VLAN_PRIO_MASK) >> in vlan_tci_prio()
1069 return (be16_to_cpu(rule->m_ext.vlan_tci) & VLAN_PRIO_MASK) >> in vlan_tci_priom()
1081 u32 old_index = tab->index; in gfar_convert_to_filer()
1084 if ((rule->flow_type & FLOW_EXT) && in gfar_convert_to_filer()
1085 (rule->m_ext.vlan_tci != cpu_to_be16(0xFFFF))) { in gfar_convert_to_filer()
1086 if (!rule->m_ext.vlan_tci) in gfar_convert_to_filer()
1087 rule->m_ext.vlan_tci = cpu_to_be16(0xFFFF); in gfar_convert_to_filer()
1107 switch (rule->flow_type & ~FLOW_EXT) { in gfar_convert_to_filer()
1111 gfar_set_basic_ip(&rule->h_u.tcp_ip4_spec, in gfar_convert_to_filer()
1112 &rule->m_u.tcp_ip4_spec, tab); in gfar_convert_to_filer()
1117 gfar_set_basic_ip(&rule->h_u.udp_ip4_spec, in gfar_convert_to_filer()
1118 &rule->m_u.udp_ip4_spec, tab); in gfar_convert_to_filer()
1124 gfar_set_basic_ip((struct ethtool_tcpip4_spec *)&rule->h_u, in gfar_convert_to_filer()
1125 (struct ethtool_tcpip4_spec *)&rule->m_u, in gfar_convert_to_filer()
1131 gfar_set_user_ip((struct ethtool_usrip4_spec *) &rule->h_u, in gfar_convert_to_filer()
1132 (struct ethtool_usrip4_spec *) &rule->m_u, in gfar_convert_to_filer()
1138 gfar_set_ether((struct ethhdr *) &rule->h_u, in gfar_convert_to_filer()
1139 (struct ethhdr *) &rule->m_u, tab); in gfar_convert_to_filer()
1142 return -1; in gfar_convert_to_filer()
1152 if (tab->index == old_index) { in gfar_convert_to_filer()
1154 tab->fe[tab->index].ctrl = 0x20; in gfar_convert_to_filer()
1155 tab->fe[tab->index].prop = 0x0; in gfar_convert_to_filer()
1156 tab->index++; in gfar_convert_to_filer()
1160 tab->fe[tab->index - 1].ctrl &= (~RQFCR_AND); in gfar_convert_to_filer()
1163 if (rule->ring_cookie == RX_CLS_FLOW_DISC) in gfar_convert_to_filer()
1164 tab->fe[tab->index - 1].ctrl |= RQFCR_RJE; in gfar_convert_to_filer()
1166 tab->fe[tab->index - 1].ctrl |= (rule->ring_cookie << 10); in gfar_convert_to_filer()
1169 if (tab->index > (old_index + 2)) { in gfar_convert_to_filer()
1170 tab->fe[old_index + 1].ctrl |= RQFCR_CLE; in gfar_convert_to_filer()
1171 tab->fe[tab->index - 1].ctrl |= RQFCR_CLE; in gfar_convert_to_filer()
1177 if (tab->index > MAX_FILER_CACHE_IDX - 1) in gfar_convert_to_filer()
1178 return -EBUSY; in gfar_convert_to_filer()
1183 /* Write the bit-pattern from software's buffer to hardware registers */
1188 if (tab->index > MAX_FILER_IDX - 1) in gfar_write_filer_table()
1189 return -EBUSY; in gfar_write_filer_table()
1192 for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++) in gfar_write_filer_table()
1193 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); in gfar_write_filer_table()
1194 /* Fill the rest with fall-troughs */ in gfar_write_filer_table()
1209 if (flow->flow_type & FLOW_EXT) { in gfar_check_capability()
1210 if (~flow->m_ext.data[0] || ~flow->m_ext.data[1]) in gfar_check_capability()
1211 netdev_warn(priv->ndev, in gfar_check_capability()
1212 "User-specific data not supported!\n"); in gfar_check_capability()
1213 if (~flow->m_ext.vlan_etype) in gfar_check_capability()
1214 netdev_warn(priv->ndev, in gfar_check_capability()
1215 "VLAN-etype not supported!\n"); in gfar_check_capability()
1217 if (flow->flow_type == IP_USER_FLOW) in gfar_check_capability()
1218 if (flow->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4) in gfar_check_capability()
1219 netdev_warn(priv->ndev, in gfar_check_capability()
1220 "IP-Version differing from IPv4 not supported!\n"); in gfar_check_capability()
1234 return -ENOMEM; in gfar_process_filer_changes()
1239 list_for_each_entry(j, &priv->rx_list.list, list) { in gfar_process_filer_changes()
1240 ret = gfar_convert_to_filer(&j->fs, tab); in gfar_process_filer_changes()
1241 if (ret == -EBUSY) { in gfar_process_filer_changes()
1242 netdev_err(priv->ndev, in gfar_process_filer_changes()
1246 if (ret == -1) { in gfar_process_filer_changes()
1247 netdev_err(priv->ndev, in gfar_process_filer_changes()
1248 "Rule not added: Unsupported Flow-type!\n"); in gfar_process_filer_changes()
1255 if (ret == -EBUSY) { in gfar_process_filer_changes()
1256 netdev_err(priv->ndev, "Rule not added: No free space!\n"); in gfar_process_filer_changes()
1269 for (i = 0; i < sizeof(flow->m_u); i++) in gfar_invert_masks()
1270 flow->m_u.hdata[i] ^= 0xFF; in gfar_invert_masks()
1272 flow->m_ext.vlan_etype ^= cpu_to_be16(0xFFFF); in gfar_invert_masks()
1273 flow->m_ext.vlan_tci ^= cpu_to_be16(0xFFFF); in gfar_invert_masks()
1274 flow->m_ext.data[0] ^= cpu_to_be32(~0); in gfar_invert_masks()
1275 flow->m_ext.data[1] ^= cpu_to_be32(~0); in gfar_invert_masks()
1286 return -ENOMEM; in gfar_add_cls()
1287 memcpy(&temp->fs, flow, sizeof(temp->fs)); in gfar_add_cls()
1289 gfar_invert_masks(&temp->fs); in gfar_add_cls()
1290 ret = gfar_check_capability(&temp->fs, priv); in gfar_add_cls()
1294 if (list_empty(&priv->rx_list.list)) { in gfar_add_cls()
1298 list_add(&temp->list, &priv->rx_list.list); in gfar_add_cls()
1301 list_for_each_entry(comp, &priv->rx_list.list, list) { in gfar_add_cls()
1302 if (comp->fs.location > flow->location) { in gfar_add_cls()
1303 list_add_tail(&temp->list, &comp->list); in gfar_add_cls()
1306 if (comp->fs.location == flow->location) { in gfar_add_cls()
1307 netdev_err(priv->ndev, in gfar_add_cls()
1309 flow->location); in gfar_add_cls()
1310 ret = -EBUSY; in gfar_add_cls()
1314 list_add_tail(&temp->list, &priv->rx_list.list); in gfar_add_cls()
1318 priv->rx_list.count++; in gfar_add_cls()
1325 priv->rx_list.count--; in gfar_add_cls()
1326 list_del(&temp->list); in gfar_add_cls()
1335 u32 ret = -EINVAL; in gfar_del_cls()
1337 if (list_empty(&priv->rx_list.list)) in gfar_del_cls()
1340 list_for_each_entry(comp, &priv->rx_list.list, list) { in gfar_del_cls()
1341 if (comp->fs.location == loc) { in gfar_del_cls()
1342 list_del(&comp->list); in gfar_del_cls()
1344 priv->rx_list.count--; in gfar_del_cls()
1357 u32 ret = -EINVAL; in gfar_get_cls()
1359 list_for_each_entry(comp, &priv->rx_list.list, list) { in gfar_get_cls()
1360 if (comp->fs.location == cmd->fs.location) { in gfar_get_cls()
1361 memcpy(&cmd->fs, &comp->fs, sizeof(cmd->fs)); in gfar_get_cls()
1362 gfar_invert_masks(&cmd->fs); in gfar_get_cls()
1377 list_for_each_entry(comp, &priv->rx_list.list, list) { in gfar_get_cls_all()
1378 if (i == cmd->rule_cnt) in gfar_get_cls_all()
1379 return -EMSGSIZE; in gfar_get_cls_all()
1380 rule_locs[i] = comp->fs.location; in gfar_get_cls_all()
1384 cmd->data = MAX_FILER_IDX; in gfar_get_cls_all()
1385 cmd->rule_cnt = i; in gfar_get_cls_all()
1395 if (test_bit(GFAR_RESETTING, &priv->state)) in gfar_set_nfc()
1396 return -EBUSY; in gfar_set_nfc()
1398 mutex_lock(&priv->rx_queue_access); in gfar_set_nfc()
1400 switch (cmd->cmd) { in gfar_set_nfc()
1405 if ((cmd->fs.ring_cookie != RX_CLS_FLOW_DISC && in gfar_set_nfc()
1406 cmd->fs.ring_cookie >= priv->num_rx_queues) || in gfar_set_nfc()
1407 cmd->fs.location >= MAX_FILER_IDX) { in gfar_set_nfc()
1408 ret = -EINVAL; in gfar_set_nfc()
1411 ret = gfar_add_cls(priv, &cmd->fs); in gfar_set_nfc()
1414 ret = gfar_del_cls(priv, cmd->fs.location); in gfar_set_nfc()
1417 ret = -EINVAL; in gfar_set_nfc()
1420 mutex_unlock(&priv->rx_queue_access); in gfar_set_nfc()
1431 switch (cmd->cmd) { in gfar_get_nfc()
1433 cmd->data = priv->num_rx_queues; in gfar_get_nfc()
1436 cmd->rule_cnt = priv->rx_list.count; in gfar_get_nfc()
1445 ret = -EINVAL; in gfar_get_nfc()
1458 struct ptp_qoriq *ptp = NULL; in gfar_get_ts_info() local
1460 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) { in gfar_get_ts_info()
1461 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE; in gfar_get_ts_info()
1465 ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp"); in gfar_get_ts_info()
1470 ptp = platform_get_drvdata(ptp_dev); in gfar_get_ts_info()
1473 if (ptp) in gfar_get_ts_info()
1474 info->phc_index = ptp->phc_index; in gfar_get_ts_info()
1476 info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | in gfar_get_ts_info()
1480 info->tx_types = (1 << HWTSTAMP_TX_OFF) | in gfar_get_ts_info()
1482 info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | in gfar_get_ts_info()