diff options
author | Taku Izumi <izumi.taku@jp.fujitsu.com> | 2015-08-21 04:29:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-24 17:06:36 -0400 |
commit | 3e3fedda31798cff2cb5358e15263b8799c1e72c (patch) | |
tree | 657876d5eefc7e4956e0396b7b732018a63f6c0e /drivers/net/fjes | |
parent | 4393e767aee706944dbdf3aa91810a0c981b6710 (diff) |
fjes: net_device_ops.ndo_vlan_rx_add/kill_vid
This patch adds net_device_ops.ndo_vlan_rx_add_vid and
net_device_ops.ndo_vlan_rx_kill_vid callback.
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fjes')
-rw-r--r-- | drivers/net/fjes/fjes_hw.c | 27 | ||||
-rw-r--r-- | drivers/net/fjes/fjes_hw.h | 2 | ||||
-rw-r--r-- | drivers/net/fjes/fjes_main.c | 40 |
3 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/fjes/fjes_hw.c b/drivers/net/fjes/fjes_hw.c index 3c96d06d15cf..4a4b750fdb9c 100644 --- a/drivers/net/fjes/fjes_hw.c +++ b/drivers/net/fjes/fjes_hw.c | |||
@@ -825,6 +825,33 @@ bool fjes_hw_check_vlan_id(struct epbuf_handler *epbh, u16 vlan_id) | |||
825 | return ret; | 825 | return ret; |
826 | } | 826 | } |
827 | 827 | ||
828 | bool fjes_hw_set_vlan_id(struct epbuf_handler *epbh, u16 vlan_id) | ||
829 | { | ||
830 | union ep_buffer_info *info = epbh->info; | ||
831 | int i; | ||
832 | |||
833 | for (i = 0; i < EP_BUFFER_SUPPORT_VLAN_MAX; i++) { | ||
834 | if (info->v1i.vlan_id[i] == 0) { | ||
835 | info->v1i.vlan_id[i] = vlan_id; | ||
836 | return true; | ||
837 | } | ||
838 | } | ||
839 | return false; | ||
840 | } | ||
841 | |||
842 | void fjes_hw_del_vlan_id(struct epbuf_handler *epbh, u16 vlan_id) | ||
843 | { | ||
844 | union ep_buffer_info *info = epbh->info; | ||
845 | int i; | ||
846 | |||
847 | if (0 != vlan_id) { | ||
848 | for (i = 0; i < EP_BUFFER_SUPPORT_VLAN_MAX; i++) { | ||
849 | if (vlan_id == info->v1i.vlan_id[i]) | ||
850 | info->v1i.vlan_id[i] = 0; | ||
851 | } | ||
852 | } | ||
853 | } | ||
854 | |||
828 | bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *epbh) | 855 | bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *epbh) |
829 | { | 856 | { |
830 | union ep_buffer_info *info = epbh->info; | 857 | union ep_buffer_info *info = epbh->info; |
diff --git a/drivers/net/fjes/fjes_hw.h b/drivers/net/fjes/fjes_hw.h index 3511db2f7eb0..95e632b363c1 100644 --- a/drivers/net/fjes/fjes_hw.h +++ b/drivers/net/fjes/fjes_hw.h | |||
@@ -322,6 +322,8 @@ int fjes_hw_epid_is_shared(struct fjes_device_shared_info *, int); | |||
322 | bool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32); | 322 | bool fjes_hw_check_epbuf_version(struct epbuf_handler *, u32); |
323 | bool fjes_hw_check_mtu(struct epbuf_handler *, u32); | 323 | bool fjes_hw_check_mtu(struct epbuf_handler *, u32); |
324 | bool fjes_hw_check_vlan_id(struct epbuf_handler *, u16); | 324 | bool fjes_hw_check_vlan_id(struct epbuf_handler *, u16); |
325 | bool fjes_hw_set_vlan_id(struct epbuf_handler *, u16); | ||
326 | void fjes_hw_del_vlan_id(struct epbuf_handler *, u16); | ||
325 | bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *); | 327 | bool fjes_hw_epbuf_rx_is_empty(struct epbuf_handler *); |
326 | void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *); | 328 | void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *); |
327 | void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *); | 329 | void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *); |
diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 94ccc115020b..4a4ce8144023 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c | |||
@@ -58,6 +58,8 @@ static irqreturn_t fjes_intr(int, void*); | |||
58 | static struct rtnl_link_stats64 * | 58 | static struct rtnl_link_stats64 * |
59 | fjes_get_stats64(struct net_device *, struct rtnl_link_stats64 *); | 59 | fjes_get_stats64(struct net_device *, struct rtnl_link_stats64 *); |
60 | static int fjes_change_mtu(struct net_device *, int); | 60 | static int fjes_change_mtu(struct net_device *, int); |
61 | static int fjes_vlan_rx_add_vid(struct net_device *, __be16 proto, u16); | ||
62 | static int fjes_vlan_rx_kill_vid(struct net_device *, __be16 proto, u16); | ||
61 | static void fjes_tx_retry(struct net_device *); | 63 | static void fjes_tx_retry(struct net_device *); |
62 | 64 | ||
63 | static int fjes_acpi_add(struct acpi_device *); | 65 | static int fjes_acpi_add(struct acpi_device *); |
@@ -226,6 +228,8 @@ static const struct net_device_ops fjes_netdev_ops = { | |||
226 | .ndo_get_stats64 = fjes_get_stats64, | 228 | .ndo_get_stats64 = fjes_get_stats64, |
227 | .ndo_change_mtu = fjes_change_mtu, | 229 | .ndo_change_mtu = fjes_change_mtu, |
228 | .ndo_tx_timeout = fjes_tx_retry, | 230 | .ndo_tx_timeout = fjes_tx_retry, |
231 | .ndo_vlan_rx_add_vid = fjes_vlan_rx_add_vid, | ||
232 | .ndo_vlan_rx_kill_vid = fjes_vlan_rx_kill_vid, | ||
229 | }; | 233 | }; |
230 | 234 | ||
231 | /* fjes_open - Called when a network interface is made active */ | 235 | /* fjes_open - Called when a network interface is made active */ |
@@ -751,6 +755,42 @@ static int fjes_change_mtu(struct net_device *netdev, int new_mtu) | |||
751 | return -EINVAL; | 755 | return -EINVAL; |
752 | } | 756 | } |
753 | 757 | ||
758 | static int fjes_vlan_rx_add_vid(struct net_device *netdev, | ||
759 | __be16 proto, u16 vid) | ||
760 | { | ||
761 | struct fjes_adapter *adapter = netdev_priv(netdev); | ||
762 | bool ret = true; | ||
763 | int epid; | ||
764 | |||
765 | for (epid = 0; epid < adapter->hw.max_epid; epid++) { | ||
766 | if (epid == adapter->hw.my_epid) | ||
767 | continue; | ||
768 | |||
769 | if (!fjes_hw_check_vlan_id( | ||
770 | &adapter->hw.ep_shm_info[epid].tx, vid)) | ||
771 | ret = fjes_hw_set_vlan_id( | ||
772 | &adapter->hw.ep_shm_info[epid].tx, vid); | ||
773 | } | ||
774 | |||
775 | return ret ? 0 : -ENOSPC; | ||
776 | } | ||
777 | |||
778 | static int fjes_vlan_rx_kill_vid(struct net_device *netdev, | ||
779 | __be16 proto, u16 vid) | ||
780 | { | ||
781 | struct fjes_adapter *adapter = netdev_priv(netdev); | ||
782 | int epid; | ||
783 | |||
784 | for (epid = 0; epid < adapter->hw.max_epid; epid++) { | ||
785 | if (epid == adapter->hw.my_epid) | ||
786 | continue; | ||
787 | |||
788 | fjes_hw_del_vlan_id(&adapter->hw.ep_shm_info[epid].tx, vid); | ||
789 | } | ||
790 | |||
791 | return 0; | ||
792 | } | ||
793 | |||
754 | static irqreturn_t fjes_intr(int irq, void *data) | 794 | static irqreturn_t fjes_intr(int irq, void *data) |
755 | { | 795 | { |
756 | struct fjes_adapter *adapter = data; | 796 | struct fjes_adapter *adapter = data; |