Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qeth: fine-tune .ndo_select_queue()

Avoid a conditional branch for L2 devices when selecting the TX queue,
and have shared logic for OSA devices.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Julian Wiedmann and committed by
Jakub Kicinski
1b9e410f cdf8df5b

+22 -30
+2 -2
drivers/s390/net/qeth_core.h
··· 1030 1030 data, QETH_PROT_IPV6); 1031 1031 } 1032 1032 1033 - int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb); 1034 - 1035 1033 extern const struct qeth_discipline qeth_l2_discipline; 1036 1034 extern const struct qeth_discipline qeth_l3_discipline; 1037 1035 extern const struct ethtool_ops qeth_ethtool_ops; ··· 1097 1099 int qeth_set_real_num_tx_queues(struct qeth_card *card, unsigned int count); 1098 1100 u16 qeth_iqd_select_queue(struct net_device *dev, struct sk_buff *skb, 1099 1101 u8 cast_type, struct net_device *sb_dev); 1102 + u16 qeth_osa_select_queue(struct net_device *dev, struct sk_buff *skb, 1103 + struct net_device *sb_dev); 1100 1104 int qeth_open(struct net_device *dev); 1101 1105 int qeth_stop(struct net_device *dev); 1102 1106
+13 -2
drivers/s390/net/qeth_core_main.c
··· 3769 3769 /* 3770 3770 * Note: Function assumes that we have 4 outbound queues. 3771 3771 */ 3772 - int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb) 3772 + static int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb) 3773 3773 { 3774 3774 struct vlan_ethhdr *veth = vlan_eth_hdr(skb); 3775 3775 u8 tos; ··· 3814 3814 } 3815 3815 return card->qdio.default_out_queue; 3816 3816 } 3817 - EXPORT_SYMBOL_GPL(qeth_get_priority_queue); 3818 3817 3819 3818 /** 3820 3819 * qeth_get_elements_for_frags() - find number of SBALEs for skb frags. ··· 7076 7077 return (txq == QETH_IQD_MCAST_TXQ) ? QETH_IQD_MIN_UCAST_TXQ : txq; 7077 7078 } 7078 7079 EXPORT_SYMBOL_GPL(qeth_iqd_select_queue); 7080 + 7081 + u16 qeth_osa_select_queue(struct net_device *dev, struct sk_buff *skb, 7082 + struct net_device *sb_dev) 7083 + { 7084 + struct qeth_card *card = dev->ml_priv; 7085 + 7086 + if (qeth_uses_tx_prio_queueing(card)) 7087 + return qeth_get_priority_queue(card, skb); 7088 + 7089 + return netdev_pick_tx(dev, skb, sb_dev); 7090 + } 7091 + EXPORT_SYMBOL_GPL(qeth_osa_select_queue); 7079 7092 7080 7093 int qeth_open(struct net_device *dev) 7081 7094 {
+6 -14
drivers/s390/net/qeth_l2_main.c
··· 519 519 return NETDEV_TX_OK; 520 520 } 521 521 522 - static u16 qeth_l2_select_queue(struct net_device *dev, struct sk_buff *skb, 523 - struct net_device *sb_dev) 522 + static u16 qeth_l2_iqd_select_queue(struct net_device *dev, struct sk_buff *skb, 523 + struct net_device *sb_dev) 524 524 { 525 - struct qeth_card *card = dev->ml_priv; 526 - 527 - if (IS_IQD(card)) 528 - return qeth_iqd_select_queue(dev, skb, 529 - qeth_get_ether_cast_type(skb), 530 - sb_dev); 531 - if (qeth_uses_tx_prio_queueing(card)) 532 - return qeth_get_priority_queue(card, skb); 533 - 534 - return netdev_pick_tx(dev, skb, sb_dev); 525 + return qeth_iqd_select_queue(dev, skb, qeth_get_ether_cast_type(skb), 526 + sb_dev); 535 527 } 536 528 537 529 static void qeth_l2_set_rx_mode(struct net_device *dev) ··· 1051 1059 .ndo_get_stats64 = qeth_get_stats64, 1052 1060 .ndo_start_xmit = qeth_l2_hard_start_xmit, 1053 1061 .ndo_features_check = qeth_features_check, 1054 - .ndo_select_queue = qeth_l2_select_queue, 1062 + .ndo_select_queue = qeth_l2_iqd_select_queue, 1055 1063 .ndo_validate_addr = qeth_l2_validate_addr, 1056 1064 .ndo_set_rx_mode = qeth_l2_set_rx_mode, 1057 1065 .ndo_eth_ioctl = qeth_do_ioctl, ··· 1072 1080 .ndo_get_stats64 = qeth_get_stats64, 1073 1081 .ndo_start_xmit = qeth_l2_hard_start_xmit, 1074 1082 .ndo_features_check = qeth_features_check, 1075 - .ndo_select_queue = qeth_l2_select_queue, 1083 + .ndo_select_queue = qeth_osa_select_queue, 1076 1084 .ndo_validate_addr = qeth_l2_validate_addr, 1077 1085 .ndo_set_rx_mode = qeth_l2_set_rx_mode, 1078 1086 .ndo_eth_ioctl = qeth_do_ioctl,
+1 -12
drivers/s390/net/qeth_l3_main.c
··· 1822 1822 qeth_l3_get_cast_type(skb, proto), sb_dev); 1823 1823 } 1824 1824 1825 - static u16 qeth_l3_osa_select_queue(struct net_device *dev, struct sk_buff *skb, 1826 - struct net_device *sb_dev) 1827 - { 1828 - struct qeth_card *card = dev->ml_priv; 1829 - 1830 - if (qeth_uses_tx_prio_queueing(card)) 1831 - return qeth_get_priority_queue(card, skb); 1832 - 1833 - return netdev_pick_tx(dev, skb, sb_dev); 1834 - } 1835 - 1836 1825 static const struct net_device_ops qeth_l3_netdev_ops = { 1837 1826 .ndo_open = qeth_open, 1838 1827 .ndo_stop = qeth_stop, ··· 1843 1854 .ndo_get_stats64 = qeth_get_stats64, 1844 1855 .ndo_start_xmit = qeth_l3_hard_start_xmit, 1845 1856 .ndo_features_check = qeth_l3_osa_features_check, 1846 - .ndo_select_queue = qeth_l3_osa_select_queue, 1857 + .ndo_select_queue = qeth_osa_select_queue, 1847 1858 .ndo_validate_addr = eth_validate_addr, 1848 1859 .ndo_set_rx_mode = qeth_l3_set_rx_mode, 1849 1860 .ndo_eth_ioctl = qeth_do_ioctl,