diff options
author | Sandeep Gopalpet <Sandeep.Kumar@freescale.com> | 2009-11-02 02:03:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-03 02:40:59 -0500 |
commit | 7a8b3372e29ff58ebdf94def26703afabd287f11 (patch) | |
tree | 7d4ae47bb2ddc7de481fb4da4a4f9f31e808e1bf /drivers/net/gianfar.c | |
parent | 46ceb60ca80fa07703bc6eb8f4651f900dff5a82 (diff) |
gianfar: Basic Support for programming hash rules
This patch provides basic hash rules programming via the ethtool
interface.
Signed-off-by: Sandeep Gopalpet <Sandeep.Kumar@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index dc9fba09b17c..086d40dd526d 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -431,6 +431,9 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
431 | #endif | 431 | #endif |
432 | }; | 432 | }; |
433 | 433 | ||
434 | unsigned int ftp_rqfpr[MAX_FILER_IDX + 1]; | ||
435 | unsigned int ftp_rqfcr[MAX_FILER_IDX + 1]; | ||
436 | |||
434 | void lock_rx_qs(struct gfar_private *priv) | 437 | void lock_rx_qs(struct gfar_private *priv) |
435 | { | 438 | { |
436 | int i = 0x0; | 439 | int i = 0x0; |
@@ -766,6 +769,73 @@ static unsigned int reverse_bitmap(unsigned int bit_map, unsigned int max_qs) | |||
766 | } | 769 | } |
767 | return new_bit_map; | 770 | return new_bit_map; |
768 | } | 771 | } |
772 | |||
773 | u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar, u32 class) | ||
774 | { | ||
775 | u32 rqfpr = FPR_FILER_MASK; | ||
776 | u32 rqfcr = 0x0; | ||
777 | |||
778 | rqfar--; | ||
779 | rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT; | ||
780 | ftp_rqfpr[rqfar] = rqfpr; | ||
781 | ftp_rqfcr[rqfar] = rqfcr; | ||
782 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | ||
783 | |||
784 | rqfar--; | ||
785 | rqfcr = RQFCR_CMP_NOMATCH; | ||
786 | ftp_rqfpr[rqfar] = rqfpr; | ||
787 | ftp_rqfcr[rqfar] = rqfcr; | ||
788 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | ||
789 | |||
790 | rqfar--; | ||
791 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND; | ||
792 | rqfpr = class; | ||
793 | ftp_rqfcr[rqfar] = rqfcr; | ||
794 | ftp_rqfpr[rqfar] = rqfpr; | ||
795 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | ||
796 | |||
797 | rqfar--; | ||
798 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND; | ||
799 | rqfpr = class; | ||
800 | ftp_rqfcr[rqfar] = rqfcr; | ||
801 | ftp_rqfpr[rqfar] = rqfpr; | ||
802 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | ||
803 | |||
804 | return rqfar; | ||
805 | } | ||
806 | |||
807 | static void gfar_init_filer_table(struct gfar_private *priv) | ||
808 | { | ||
809 | int i = 0x0; | ||
810 | u32 rqfar = MAX_FILER_IDX; | ||
811 | u32 rqfcr = 0x0; | ||
812 | u32 rqfpr = FPR_FILER_MASK; | ||
813 | |||
814 | /* Default rule */ | ||
815 | rqfcr = RQFCR_CMP_MATCH; | ||
816 | ftp_rqfcr[rqfar] = rqfcr; | ||
817 | ftp_rqfpr[rqfar] = rqfpr; | ||
818 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | ||
819 | |||
820 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6); | ||
821 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6 | RQFPR_UDP); | ||
822 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6 | RQFPR_TCP); | ||
823 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4); | ||
824 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4 | RQFPR_UDP); | ||
825 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV4 | RQFPR_TCP); | ||
826 | |||
827 | /* cur_filer_idx indicated the fisrt non-masked rule */ | ||
828 | priv->cur_filer_idx = rqfar; | ||
829 | |||
830 | /* Rest are masked rules */ | ||
831 | rqfcr = RQFCR_CMP_NOMATCH; | ||
832 | for (i = 0; i < rqfar; i++) { | ||
833 | ftp_rqfcr[i] = rqfcr; | ||
834 | ftp_rqfpr[i] = rqfpr; | ||
835 | gfar_write_filer(priv, i, rqfcr, rqfpr); | ||
836 | } | ||
837 | } | ||
838 | |||
769 | /* Set up the ethernet device structure, private data, | 839 | /* Set up the ethernet device structure, private data, |
770 | * and anything else we need before we start */ | 840 | * and anything else we need before we start */ |
771 | static int gfar_probe(struct of_device *ofdev, | 841 | static int gfar_probe(struct of_device *ofdev, |
@@ -1005,6 +1075,9 @@ static int gfar_probe(struct of_device *ofdev, | |||
1005 | priv->gfargrp[i].int_name_tx[len_devname] = '\0'; | 1075 | priv->gfargrp[i].int_name_tx[len_devname] = '\0'; |
1006 | } | 1076 | } |
1007 | 1077 | ||
1078 | /* Initialize the filer table */ | ||
1079 | gfar_init_filer_table(priv); | ||
1080 | |||
1008 | /* Create all the sysfs files */ | 1081 | /* Create all the sysfs files */ |
1009 | gfar_init_sysfs(dev); | 1082 | gfar_init_sysfs(dev); |
1010 | 1083 | ||