aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-05-10 11:58:07 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-13 02:31:15 -0400
commitf8f5aafa960883bc3f1b8f85f1cf8199d0c85879 (patch)
tree1b8fbf1aaed6fc2ad2bf91a2a3e3221fe127715d
parent10df0b9116e2039d5585a196753e5f36d7afcba2 (diff)
cxgb4: configure HW VLAN extraction through FW
HW VLAN extraction needs to be configured through FW to work correctly in virtualization environments. Remove the direct register manipulation and rely on FW. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/cxgb4/cxgb4.h4
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c9
-rw-r--r--drivers/net/cxgb4/t4_hw.c31
-rw-r--r--drivers/net/cxgb4/t4fw_api.h4
4 files changed, 20 insertions, 28 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index 8856a75fcc9..d3a5c3433df 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -656,7 +656,6 @@ int t4_check_fw_version(struct adapter *adapter);
656int t4_prep_adapter(struct adapter *adapter); 656int t4_prep_adapter(struct adapter *adapter);
657int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); 657int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
658void t4_fatal_err(struct adapter *adapter); 658void t4_fatal_err(struct adapter *adapter);
659void t4_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on);
660int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, 659int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp,
661 int filter_index, int enable); 660 int filter_index, int enable);
662void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, 661void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp,
@@ -707,7 +706,8 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
707int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, 706int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
708 unsigned int vf, unsigned int viid); 707 unsigned int vf, unsigned int viid);
709int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 708int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
710 int mtu, int promisc, int all_multi, int bcast, bool sleep_ok); 709 int mtu, int promisc, int all_multi, int bcast, int vlanex,
710 bool sleep_ok);
711int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, 711int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
712 unsigned int viid, bool free, unsigned int naddr, 712 unsigned int viid, bool free, unsigned int naddr,
713 const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); 713 const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok);
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 1bad5004142..a73cda9c9de 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -290,7 +290,7 @@ static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok)
290 if (ret == 0) 290 if (ret == 0)
291 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, mtu, 291 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, mtu,
292 (dev->flags & IFF_PROMISC) ? 1 : 0, 292 (dev->flags & IFF_PROMISC) ? 1 : 0,
293 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, 293 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, -1,
294 sleep_ok); 294 sleep_ok);
295 return ret; 295 return ret;
296} 296}
@@ -311,7 +311,7 @@ static int link_start(struct net_device *dev)
311 * that step explicitly. 311 * that step explicitly.
312 */ 312 */
313 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, dev->mtu, -1, -1, -1, 313 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, dev->mtu, -1, -1, -1,
314 true); 314 pi->vlan_grp != NULL, true);
315 if (ret == 0) { 315 if (ret == 0) {
316 ret = t4_change_mac(pi->adapter, 0, pi->viid, 316 ret = t4_change_mac(pi->adapter, 0, pi->viid,
317 pi->xact_addr_filt, dev->dev_addr, true, 317 pi->xact_addr_filt, dev->dev_addr, true,
@@ -2614,7 +2614,7 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
2614 2614
2615 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */ 2615 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */
2616 return -EINVAL; 2616 return -EINVAL;
2617 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, new_mtu, -1, -1, -1, 2617 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, new_mtu, -1, -1, -1, -1,
2618 true); 2618 true);
2619 if (!ret) 2619 if (!ret)
2620 dev->mtu = new_mtu; 2620 dev->mtu = new_mtu;
@@ -2645,7 +2645,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2645 struct port_info *pi = netdev_priv(dev); 2645 struct port_info *pi = netdev_priv(dev);
2646 2646
2647 pi->vlan_grp = grp; 2647 pi->vlan_grp = grp;
2648 t4_set_vlan_accel(pi->adapter, 1 << pi->tx_chan, grp != NULL); 2648 t4_set_rxmode(pi->adapter, 0, pi->viid, -1, -1, -1, -1, grp != NULL,
2649 true);
2649} 2650}
2650 2651
2651#ifdef CONFIG_NET_POLL_CONTROLLER 2652#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
index 2923dd43523..da272a98fdb 100644
--- a/drivers/net/cxgb4/t4_hw.c
+++ b/drivers/net/cxgb4/t4_hw.c
@@ -886,22 +886,6 @@ int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port)
886 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); 886 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
887} 887}
888 888
889/**
890 * t4_set_vlan_accel - configure HW VLAN extraction
891 * @adap: the adapter
892 * @ports: bitmap of adapter ports to operate on
893 * @on: enable (1) or disable (0) HW VLAN extraction
894 *
895 * Enables or disables HW extraction of VLAN tags for the ports specified
896 * by @ports. @ports is a bitmap with the ith bit designating the port
897 * associated with the ith adapter channel.
898 */
899void t4_set_vlan_accel(struct adapter *adap, unsigned int ports, int on)
900{
901 ports <<= VLANEXTENABLE_SHIFT;
902 t4_set_reg_field(adap, TP_OUT_CONFIG, ports, on ? ports : 0);
903}
904
905struct intr_info { 889struct intr_info {
906 unsigned int mask; /* bits to check in interrupt status */ 890 unsigned int mask; /* bits to check in interrupt status */
907 const char *msg; /* message to print or NULL */ 891 const char *msg; /* message to print or NULL */
@@ -2624,12 +2608,14 @@ int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
2624 * @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change 2608 * @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change
2625 * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change 2609 * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change
2626 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change 2610 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change
2611 * @vlanex: 1 to enable HW VLAN extraction, 0 to disable it, -1 no change
2627 * @sleep_ok: if true we may sleep while awaiting command completion 2612 * @sleep_ok: if true we may sleep while awaiting command completion
2628 * 2613 *
2629 * Sets Rx properties of a virtual interface. 2614 * Sets Rx properties of a virtual interface.
2630 */ 2615 */
2631int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 2616int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
2632 int mtu, int promisc, int all_multi, int bcast, bool sleep_ok) 2617 int mtu, int promisc, int all_multi, int bcast, int vlanex,
2618 bool sleep_ok)
2633{ 2619{
2634 struct fw_vi_rxmode_cmd c; 2620 struct fw_vi_rxmode_cmd c;
2635 2621
@@ -2642,15 +2628,18 @@ int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
2642 all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_MASK; 2628 all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_MASK;
2643 if (bcast < 0) 2629 if (bcast < 0)
2644 bcast = FW_VI_RXMODE_CMD_BROADCASTEN_MASK; 2630 bcast = FW_VI_RXMODE_CMD_BROADCASTEN_MASK;
2631 if (vlanex < 0)
2632 vlanex = FW_VI_RXMODE_CMD_VLANEXEN_MASK;
2645 2633
2646 memset(&c, 0, sizeof(c)); 2634 memset(&c, 0, sizeof(c));
2647 c.op_to_viid = htonl(FW_CMD_OP(FW_VI_RXMODE_CMD) | FW_CMD_REQUEST | 2635 c.op_to_viid = htonl(FW_CMD_OP(FW_VI_RXMODE_CMD) | FW_CMD_REQUEST |
2648 FW_CMD_WRITE | FW_VI_RXMODE_CMD_VIID(viid)); 2636 FW_CMD_WRITE | FW_VI_RXMODE_CMD_VIID(viid));
2649 c.retval_len16 = htonl(FW_LEN16(c)); 2637 c.retval_len16 = htonl(FW_LEN16(c));
2650 c.mtu_to_broadcasten = htonl(FW_VI_RXMODE_CMD_MTU(mtu) | 2638 c.mtu_to_vlanexen = htonl(FW_VI_RXMODE_CMD_MTU(mtu) |
2651 FW_VI_RXMODE_CMD_PROMISCEN(promisc) | 2639 FW_VI_RXMODE_CMD_PROMISCEN(promisc) |
2652 FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) | 2640 FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) |
2653 FW_VI_RXMODE_CMD_BROADCASTEN(bcast)); 2641 FW_VI_RXMODE_CMD_BROADCASTEN(bcast) |
2642 FW_VI_RXMODE_CMD_VLANEXEN(vlanex));
2654 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok); 2643 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok);
2655} 2644}
2656 2645
diff --git a/drivers/net/cxgb4/t4fw_api.h b/drivers/net/cxgb4/t4fw_api.h
index 3393d05a388..63991d68950 100644
--- a/drivers/net/cxgb4/t4fw_api.h
+++ b/drivers/net/cxgb4/t4fw_api.h
@@ -876,7 +876,7 @@ struct fw_vi_mac_cmd {
876struct fw_vi_rxmode_cmd { 876struct fw_vi_rxmode_cmd {
877 __be32 op_to_viid; 877 __be32 op_to_viid;
878 __be32 retval_len16; 878 __be32 retval_len16;
879 __be32 mtu_to_broadcasten; 879 __be32 mtu_to_vlanexen;
880 __be32 r4_lo; 880 __be32 r4_lo;
881}; 881};
882 882
@@ -888,6 +888,8 @@ struct fw_vi_rxmode_cmd {
888#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12) 888#define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
889#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3 889#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
890#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10) 890#define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
891#define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
892#define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
891 893
892struct fw_vi_enable_cmd { 894struct fw_vi_enable_cmd {
893 __be32 op_to_viid; 895 __be32 op_to_viid;