cxgb4: configure HW VLAN extraction through FW
Subsystems (2)
PATCH 1/3 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.
--- drivers/net/cxgb4/cxgb4.h | 4 ++-- drivers/net/cxgb4/cxgb4_main.c | 9 +++++---- drivers/net/cxgb4/t4_hw.c | 31 ++++++++++--------------------- drivers/net/cxgb4/t4fw_api.h | 4 +++- 4 files changed, 20 insertions(+), 28 deletions(-)
drivers/net/cxgb4/cxgb4.h +2 -2
@@ -656,7 +656,6 @@ int t4_check_fw_version(struct adapter *adapter);int t4_prep_adapter (struct adapter *adapter);int t4_port_init (struct adapter *adap,int mbox,int pf,int vf);void t4_fatal_err (struct adapter *adapter); -void t4_set_vlan_accel (struct adapter *adapter,unsigned int ports,int on);int t4_set_trace_filter (struct adapter *adapter,const struct trace_params *tp,int filter_index,int enable); void 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,int t4_free_vi (struct adapter *adap,unsigned int mbox,unsigned int pf,unsigned int vf,unsigned int viid);int t4_set_rxmode (struct adapter *adap,unsigned int mbox,unsigned int viid, -int mtu,int promisc,int all_multi,int bcast,bool sleep_ok); +int mtu,int promisc,int all_multi,int bcast,int vlanex, +bool sleep_ok);int t4_alloc_mac_filt (struct adapter *adap,unsigned int mbox,unsigned int viid,bool free,unsigned int naddr,const u8 **addr,u16 *idx,u64 *hash,bool sleep_ok);
drivers/net/cxgb4/cxgb4_main.c +5 -4
@@ -290,7 +290,7 @@ static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok)if (ret ==0 ) ret =t4_set_rxmode (pi->adapter,0 , pi->viid, mtu, (dev->flags &IFF_PROMISC ) ?1 :0 , - (dev->flags &IFF_ALLMULTI ) ?1 :0 ,1 , + (dev->flags &IFF_ALLMULTI ) ?1 :0 ,1 ,-1 , sleep_ok);return ret; }
@@ -311,7 +311,7 @@ static int link_start(struct net_device *dev)* that step explicitly. */ ret =t4_set_rxmode (pi->adapter,0 , pi->viid, dev->mtu,-1 ,-1 ,-1 , - true); + pi->vlan_grp !=NULL , true);if (ret ==0 ) { ret = t4_change_mac(pi->adapter, 0, pi->viid, pi->xact_addr_filt, dev->dev_addr, true,
@@ -2614,7 +2614,7 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)if (new_mtu <81 || new_mtu >MAX_MTU )/* accommodate SACK */ return -EINVAL ; - ret =t4_set_rxmode (pi->adapter,0 , pi->viid, new_mtu,-1 ,-1 ,-1 , + ret =t4_set_rxmode (pi->adapter,0 , pi->viid, new_mtu,-1 ,-1 ,-1 ,-1 , true);if (!ret) dev->mtu = new_mtu;
@@ -2645,7 +2645,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)struct port_info *pi =netdev_priv (dev); pi->vlan_grp = grp; -t4_set_vlan_accel (pi->adapter,1 << pi->tx_chan, grp !=NULL ); +t4_set_rxmode (pi->adapter,0 , pi->viid,-1 ,-1 ,-1 ,-1 , grp !=NULL , + true); }#ifdef CONFIG_NET_POLL_CONTROLLER
drivers/net/cxgb4/t4_hw.c +10 -21
@@ -886,22 +886,6 @@ int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port)return t4_wr_mbox (adap, mbox, &c,sizeof (c),NULL ); } -/** -* t4_set_vlan_accel - configure HW VLAN extraction -* @adap: the adapter -* @ports: bitmap of adapter ports to operate on -* @on: enable (1) or disable (0) HW VLAN extraction -* -* Enables or disables HW extraction of VLAN tags for the ports specified -* by @ports. @ports is a bitmap with the ith bit designating the port -* associated with the ith adapter channel. -*/ -void t4_set_vlan_accel (struct adapter *adap,unsigned int ports,int on) -{ - ports <<=VLANEXTENABLE_SHIFT ; -t4_set_reg_field (adap,TP_OUT_CONFIG , ports, on ? ports :0 ); -} -struct intr_info {unsigned int mask;/* bits to check in interrupt status */ 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,* @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change +* @vlanex: 1 to enable HW VLAN extraction, 0 to disable it, -1 no change * @sleep_ok: if true we may sleep while awaiting command completion * * Sets Rx properties of a virtual interface. */ int t4_set_rxmode (struct adapter *adap,unsigned int mbox,unsigned int viid, -int mtu,int promisc,int all_multi,int bcast,bool sleep_ok) +int mtu,int promisc,int all_multi,int bcast,int vlanex, +bool sleep_ok) {struct fw_vi_rxmode_cmd c;
@@ -2642,15 +2628,18 @@ int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, all_multi =FW_VI_RXMODE_CMD_ALLMULTIEN_MASK ;if (bcast <0 ) bcast =FW_VI_RXMODE_CMD_BROADCASTEN_MASK ; +if (vlanex <0 ) + vlanex =FW_VI_RXMODE_CMD_VLANEXEN_MASK ;memset (&c,0 ,sizeof (c)); c.op_to_viid =htonl (FW_CMD_OP (FW_VI_RXMODE_CMD ) |FW_CMD_REQUEST |FW_CMD_WRITE |FW_VI_RXMODE_CMD_VIID (viid)); c.retval_len16 =htonl (FW_LEN16 (c)); - c.mtu_to_broadcasten =htonl (FW_VI_RXMODE_CMD_MTU (mtu) | -FW_VI_RXMODE_CMD_PROMISCEN (promisc) | -FW_VI_RXMODE_CMD_ALLMULTIEN (all_multi) | -FW_VI_RXMODE_CMD_BROADCASTEN (bcast)); + c.mtu_to_vlanexen =htonl (FW_VI_RXMODE_CMD_MTU (mtu) | +FW_VI_RXMODE_CMD_PROMISCEN (promisc) | +FW_VI_RXMODE_CMD_ALLMULTIEN (all_multi) | +FW_VI_RXMODE_CMD_BROADCASTEN (bcast) | +FW_VI_RXMODE_CMD_VLANEXEN (vlanex));return t4_wr_mbox_meat (adap, mbox, &c,sizeof (c),NULL , sleep_ok); }
drivers/net/cxgb4/t4fw_api.h +3 -1
@@ -876,7 +876,7 @@ struct fw_vi_mac_cmd {struct fw_vi_rxmode_cmd {__be32 op_to_viid;__be32 retval_len16; -__be32 mtu_to_broadcasten; +__be32 mtu_to_vlanexen;__be32 r4_lo; };
@@ -888,6 +888,8 @@ struct fw_vi_rxmode_cmd {#define FW_VI_RXMODE_CMD_ALLMULTIEN (x) ((x) << 12)#define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3#define FW_VI_RXMODE_CMD_BROADCASTEN (x) ((x) << 10) +#define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3 +#define FW_VI_RXMODE_CMD_VLANEXEN (x) ((x) << 8)struct fw_vi_enable_cmd {__be32 op_to_viid;
Signature · 1 line
1.5.4
PATCH 2/3 cxgb4: report the PCIe link speed
Report the PCIe link speed (2.5 or 5 Gbps).
--- drivers/net/cxgb4/cxgb4_main.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/cxgb4/cxgb4_main.c +8 -2
@@ -3080,6 +3080,12 @@ static void __devinit print_port_info(struct adapter *adap)int i;char buf[80 ]; +const char *spd ="" ; + +if (adap->params.pci.speed ==PCI_EXP_LNKSTA_CLS_2_5GB ) + spd =" 2.5 GT/s" ; +else if (adap->params.pci.speed ==PCI_EXP_LNKSTA_CLS_5_0GB ) + spd =" 5 GT/s" ;for_each_port (adap, i) {struct net_device *dev = adap->port[i];
@@ -3099,10 +3105,10 @@ static void __devinit print_port_info(struct adapter *adap) --bufp;sprintf (bufp,"BASE-%s" , base[pi->port_type]); -netdev_info (dev,"Chelsio %s rev %d %s %sNIC PCIe x%d%s\n" , +netdev_info (dev,"Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n" , adap->params.vpd.id, adap->params.rev, buf,is_offload (adap) ?"R" :"" , - adap->params.pci.width, + adap->params.pci.width, spd, (adap->flags &USING_MSIX ) ?" MSI-X" : (adap->flags &USING_MSI ) ?" MSI" :"" );if (adap->name == dev->name)
Signature · 1 line
1.5.4
PATCH 3/3 cxgb4: report GRO stats with ethtool -S
--- drivers/net/cxgb4/cxgb4_main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/cxgb4/cxgb4_main.c +6 -0
@@ -859,6 +859,8 @@ static char stats_strings[][ETH_GSTRING_LEN] = {"RxCsumGood " ,"VLANextractions " ,"VLANinsertions " , +"GROpackets " , + "GROmerged ", };static int get_sset_count (struct net_device *dev,int sset)
@@ -922,6 +924,8 @@ struct queue_port_stats {u64 rx_csum;u64 vlan_ex;u64 vlan_ins; +u64 gro_pkts; +u64 gro_merged; }; static void collect_sge_port_stats(const struct adapter *adap,
@@ -938,6 +942,8 @@ static void collect_sge_port_stats(const struct adapter *adap, s->rx_csum += rx->stats.rx_cso; s->vlan_ex += rx->stats.vlan_ex; s->vlan_ins += tx->vlan_ins; + s->gro_pkts += rx->stats.lro_pkts; + s->gro_merged += rx->stats.lro_merged; } }
Signature · 1 line
1.5.4
Re: [PATCH net-next 3/3] cxgb4: report GRO stats with ethtool -S
Quoted 1 line · Dimitris Michailidis
Signed-off-by Dimitris Michailidis<[email protected]>
One of these is on-wire packets? If so, maybe use the same string as Intel ixgbe uses:
rx_pkts_nic # Pkts received by NIC from wire. rx_bytes_nic # Bytes received by NIC from wire. tx_pkts_nic # Pkts transmitted to wire by NIC. tx_bytes_nic # Bytes transmitted to wire by NIC.
Thanks,
Ben
Quoted 35 lines
--- drivers/net/cxgb4/cxgb4_main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)drivers/net/cxgb4/cxgb4_main.c +6
-0@@ -859,6 +859,8 @@ static char stats_strings[][ETH_GSTRING_LEN] = {"RxCsumGood " ,"VLANextractions " ,"VLANinsertions " , +"GROpackets " , + "GROmerged ", };static int get_sset_count (struct net_device *dev,int sset)@@ -922,6 +924,8 @@ struct queue_port_stats {u64 rx_csum;u64 vlan_ex;u64 vlan_ins; +u64 gro_pkts; +u64 gro_merged; }; static void collect_sge_port_stats(const struct adapter *adap,@@ -938,6 +942,8 @@ static void collect_sge_port_stats(const struct adapter *adap, s->rx_csum += rx->stats.rx_cso; s->vlan_ex += rx->stats.vlan_ex; s->vlan_ins += tx->vlan_ins; + s->gro_pkts += rx->stats.lro_pkts; + s->gro_merged += rx->stats.lro_merged; } }
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Re: [PATCH net-next 3/3] cxgb4: report GRO stats with ethtool -S
Quoted 10 lines · Ben Greear
Quoted 1 line · Dimitris Michailidis
Signed-off-by Dimitris Michailidis<[email protected]>One of these is on-wire packets? If so, maybe use the same string as Intel ixgbe uses:
rx_pkts_nic# Pkts received by NIC from wire.rx_bytes_nic# Bytes received by NIC from wire.tx_pkts_nic# Pkts transmitted to wire by NIC.tx_bytes_nic# Bytes transmitted to wire by NIC.
The two stats I'm adding don't correspond to any of the 4 above. One is the superpackets coming out of GRO, the other is packets merged by GRO to create the superpackets.
Quoted 44 lines
Thanks,
BenQuoted 36 lines
--- drivers/net/cxgb4/cxgb4_main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)drivers/net/cxgb4/cxgb4_main.c +6
-0@@ -859,6 +859,8 @@ static char stats_strings[][ETH_GSTRING_LEN] = {"RxCsumGood " ,"VLANextractions " ,"VLANinsertions " , +"GROpackets " , + "GROmerged ", };static int get_sset_count (struct net_device *dev,int sset)@@ -922,6 +924,8 @@ struct queue_port_stats {u64 rx_csum;u64 vlan_ex;u64 vlan_ins; +u64 gro_pkts; +u64 gro_merged; }; static void collect_sge_port_stats(const struct adapter *adap,@@ -938,6 +942,8 @@ static void collect_sge_port_stats(const struct adapter *adap, s->rx_csum += rx->stats.rx_cso; s->vlan_ex += rx->stats.vlan_ex; s->vlan_ins += tx->vlan_ins; + s->gro_pkts += rx->stats.lro_pkts; + s->gro_merged += rx->stats.lro_merged; } }
Re: [PATCH net-next 3/3] cxgb4: report GRO stats with ethtool -S
In reply to Dimitris MichailidisFrom: Dimitris Michailidis <[email protected]>
Date: Mon, 10 May 2010 18:58:09 -0700
Quoted 1 line
Signed-off-by Dimitris Michailidis <[email protected]>
Applied.
Re: [PATCH net-next 2/3] cxgb4: report the PCIe link speed
In reply to Dimitris MichailidisFrom: Dimitris Michailidis <[email protected]>
Date: Mon, 10 May 2010 18:58:08 -0700
Quoted 3 lines
Report the PCIe link speed (2.5 or 5 Gbps).
Signed-off-by Dimitris Michailidis <[email protected]>
Applied.
From: Dimitris Michailidis <[email protected]>
Date: Mon, 10 May 2010 18:58:07 -0700
Quoted 5 lines
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 <[email protected]>
Applied.