mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 14:26:42 +07:00
net: consolidate 8021q tagging
Now that VLAN packets are tagged in dev_hard_start_xmit() at the bottom of the stack we no longer need to tag them in the 8021Q module (Except in the !VLAN_FLAG_REORDER_HDR case). This allows the accel path and non accel paths to be consolidated. Here the vlan_tci in the skb is always set and we allow the stack to add the actual tag in dev_hard_start_xmit(). Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8f5549f381
commit
636e19a342
@ -45,8 +45,6 @@ struct vlan_rx_stats {
|
|||||||
* @real_dev: underlying netdevice
|
* @real_dev: underlying netdevice
|
||||||
* @real_dev_addr: address of underlying netdevice
|
* @real_dev_addr: address of underlying netdevice
|
||||||
* @dent: proc dir entry
|
* @dent: proc dir entry
|
||||||
* @cnt_inc_headroom_on_tx: statistic - number of skb expansions on TX
|
|
||||||
* @cnt_encap_on_xmit: statistic - number of skb encapsulations on TX
|
|
||||||
* @vlan_rx_stats: ptr to percpu rx stats
|
* @vlan_rx_stats: ptr to percpu rx stats
|
||||||
*/
|
*/
|
||||||
struct vlan_dev_info {
|
struct vlan_dev_info {
|
||||||
@ -62,8 +60,6 @@ struct vlan_dev_info {
|
|||||||
unsigned char real_dev_addr[ETH_ALEN];
|
unsigned char real_dev_addr[ETH_ALEN];
|
||||||
|
|
||||||
struct proc_dir_entry *dent;
|
struct proc_dir_entry *dent;
|
||||||
unsigned long cnt_inc_headroom_on_tx;
|
|
||||||
unsigned long cnt_encap_on_xmit;
|
|
||||||
struct vlan_rx_stats __percpu *vlan_rx_stats;
|
struct vlan_rx_stats __percpu *vlan_rx_stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -323,51 +323,13 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
|
|||||||
*/
|
*/
|
||||||
if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
|
if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
|
||||||
vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) {
|
vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) {
|
||||||
unsigned int orig_headroom = skb_headroom(skb);
|
|
||||||
u16 vlan_tci;
|
u16 vlan_tci;
|
||||||
|
|
||||||
vlan_dev_info(dev)->cnt_encap_on_xmit++;
|
|
||||||
|
|
||||||
vlan_tci = vlan_dev_info(dev)->vlan_id;
|
|
||||||
vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
|
|
||||||
skb = __vlan_put_tag(skb, vlan_tci);
|
|
||||||
if (!skb) {
|
|
||||||
txq->tx_dropped++;
|
|
||||||
return NETDEV_TX_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (orig_headroom < VLAN_HLEN)
|
|
||||||
vlan_dev_info(dev)->cnt_inc_headroom_on_tx++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
|
|
||||||
len = skb->len;
|
|
||||||
ret = dev_queue_xmit(skb);
|
|
||||||
|
|
||||||
if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
|
|
||||||
txq->tx_packets++;
|
|
||||||
txq->tx_bytes += len;
|
|
||||||
} else
|
|
||||||
txq->tx_dropped++;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
|
|
||||||
struct net_device *dev)
|
|
||||||
{
|
|
||||||
int i = skb_get_queue_mapping(skb);
|
|
||||||
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
||||||
u16 vlan_tci;
|
|
||||||
unsigned int len;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
vlan_tci = vlan_dev_info(dev)->vlan_id;
|
vlan_tci = vlan_dev_info(dev)->vlan_id;
|
||||||
vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
|
vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
|
||||||
skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
|
skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
|
||||||
|
}
|
||||||
|
|
||||||
skb->dev = vlan_dev_info(dev)->real_dev;
|
skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
|
||||||
len = skb->len;
|
len = skb->len;
|
||||||
ret = dev_queue_xmit(skb);
|
ret = dev_queue_xmit(skb);
|
||||||
|
|
||||||
@ -716,8 +678,7 @@ static const struct header_ops vlan_header_ops = {
|
|||||||
.parse = eth_header_parse,
|
.parse = eth_header_parse,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops,
|
static const struct net_device_ops vlan_netdev_ops, vlan_netdev_ops_sq;
|
||||||
vlan_netdev_ops_sq, vlan_netdev_accel_ops_sq;
|
|
||||||
|
|
||||||
static int vlan_dev_init(struct net_device *dev)
|
static int vlan_dev_init(struct net_device *dev)
|
||||||
{
|
{
|
||||||
@ -752,18 +713,15 @@ static int vlan_dev_init(struct net_device *dev)
|
|||||||
if (real_dev->features & NETIF_F_HW_VLAN_TX) {
|
if (real_dev->features & NETIF_F_HW_VLAN_TX) {
|
||||||
dev->header_ops = real_dev->header_ops;
|
dev->header_ops = real_dev->header_ops;
|
||||||
dev->hard_header_len = real_dev->hard_header_len;
|
dev->hard_header_len = real_dev->hard_header_len;
|
||||||
if (real_dev->netdev_ops->ndo_select_queue)
|
|
||||||
dev->netdev_ops = &vlan_netdev_accel_ops_sq;
|
|
||||||
else
|
|
||||||
dev->netdev_ops = &vlan_netdev_accel_ops;
|
|
||||||
} else {
|
} else {
|
||||||
dev->header_ops = &vlan_header_ops;
|
dev->header_ops = &vlan_header_ops;
|
||||||
dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
|
dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
|
||||||
|
}
|
||||||
|
|
||||||
if (real_dev->netdev_ops->ndo_select_queue)
|
if (real_dev->netdev_ops->ndo_select_queue)
|
||||||
dev->netdev_ops = &vlan_netdev_ops_sq;
|
dev->netdev_ops = &vlan_netdev_ops_sq;
|
||||||
else
|
else
|
||||||
dev->netdev_ops = &vlan_netdev_ops;
|
dev->netdev_ops = &vlan_netdev_ops;
|
||||||
}
|
|
||||||
|
|
||||||
if (is_vlan_dev(real_dev))
|
if (is_vlan_dev(real_dev))
|
||||||
subclass = 1;
|
subclass = 1;
|
||||||
@ -905,30 +863,6 @@ static const struct net_device_ops vlan_netdev_ops = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct net_device_ops vlan_netdev_accel_ops = {
|
|
||||||
.ndo_change_mtu = vlan_dev_change_mtu,
|
|
||||||
.ndo_init = vlan_dev_init,
|
|
||||||
.ndo_uninit = vlan_dev_uninit,
|
|
||||||
.ndo_open = vlan_dev_open,
|
|
||||||
.ndo_stop = vlan_dev_stop,
|
|
||||||
.ndo_start_xmit = vlan_dev_hwaccel_hard_start_xmit,
|
|
||||||
.ndo_validate_addr = eth_validate_addr,
|
|
||||||
.ndo_set_mac_address = vlan_dev_set_mac_address,
|
|
||||||
.ndo_set_rx_mode = vlan_dev_set_rx_mode,
|
|
||||||
.ndo_set_multicast_list = vlan_dev_set_rx_mode,
|
|
||||||
.ndo_change_rx_flags = vlan_dev_change_rx_flags,
|
|
||||||
.ndo_do_ioctl = vlan_dev_ioctl,
|
|
||||||
.ndo_neigh_setup = vlan_dev_neigh_setup,
|
|
||||||
.ndo_get_stats64 = vlan_dev_get_stats64,
|
|
||||||
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
|
||||||
.ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
|
|
||||||
.ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
|
|
||||||
.ndo_fcoe_enable = vlan_dev_fcoe_enable,
|
|
||||||
.ndo_fcoe_disable = vlan_dev_fcoe_disable,
|
|
||||||
.ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct net_device_ops vlan_netdev_ops_sq = {
|
static const struct net_device_ops vlan_netdev_ops_sq = {
|
||||||
.ndo_select_queue = vlan_dev_select_queue,
|
.ndo_select_queue = vlan_dev_select_queue,
|
||||||
.ndo_change_mtu = vlan_dev_change_mtu,
|
.ndo_change_mtu = vlan_dev_change_mtu,
|
||||||
@ -954,31 +888,6 @@ static const struct net_device_ops vlan_netdev_ops_sq = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct net_device_ops vlan_netdev_accel_ops_sq = {
|
|
||||||
.ndo_select_queue = vlan_dev_select_queue,
|
|
||||||
.ndo_change_mtu = vlan_dev_change_mtu,
|
|
||||||
.ndo_init = vlan_dev_init,
|
|
||||||
.ndo_uninit = vlan_dev_uninit,
|
|
||||||
.ndo_open = vlan_dev_open,
|
|
||||||
.ndo_stop = vlan_dev_stop,
|
|
||||||
.ndo_start_xmit = vlan_dev_hwaccel_hard_start_xmit,
|
|
||||||
.ndo_validate_addr = eth_validate_addr,
|
|
||||||
.ndo_set_mac_address = vlan_dev_set_mac_address,
|
|
||||||
.ndo_set_rx_mode = vlan_dev_set_rx_mode,
|
|
||||||
.ndo_set_multicast_list = vlan_dev_set_rx_mode,
|
|
||||||
.ndo_change_rx_flags = vlan_dev_change_rx_flags,
|
|
||||||
.ndo_do_ioctl = vlan_dev_ioctl,
|
|
||||||
.ndo_neigh_setup = vlan_dev_neigh_setup,
|
|
||||||
.ndo_get_stats64 = vlan_dev_get_stats64,
|
|
||||||
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
|
||||||
.ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
|
|
||||||
.ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
|
|
||||||
.ndo_fcoe_enable = vlan_dev_fcoe_enable,
|
|
||||||
.ndo_fcoe_disable = vlan_dev_fcoe_disable,
|
|
||||||
.ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
void vlan_setup(struct net_device *dev)
|
void vlan_setup(struct net_device *dev)
|
||||||
{
|
{
|
||||||
ether_setup(dev);
|
ether_setup(dev);
|
||||||
|
@ -299,10 +299,6 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
|
|||||||
seq_puts(seq, "\n");
|
seq_puts(seq, "\n");
|
||||||
seq_printf(seq, fmt64, "total frames transmitted", stats->tx_packets);
|
seq_printf(seq, fmt64, "total frames transmitted", stats->tx_packets);
|
||||||
seq_printf(seq, fmt64, "total bytes transmitted", stats->tx_bytes);
|
seq_printf(seq, fmt64, "total bytes transmitted", stats->tx_bytes);
|
||||||
seq_printf(seq, fmt, "total headroom inc",
|
|
||||||
dev_info->cnt_inc_headroom_on_tx);
|
|
||||||
seq_printf(seq, fmt, "total encap on xmit",
|
|
||||||
dev_info->cnt_encap_on_xmit);
|
|
||||||
seq_printf(seq, "Device: %s", dev_info->real_dev->name);
|
seq_printf(seq, "Device: %s", dev_info->real_dev->name);
|
||||||
/* now show all PRIORITY mappings relating to this VLAN */
|
/* now show all PRIORITY mappings relating to this VLAN */
|
||||||
seq_printf(seq, "\nINGRESS priority mappings: "
|
seq_printf(seq, "\nINGRESS priority mappings: "
|
||||||
|
Loading…
Reference in New Issue
Block a user