@@ -2898,10 +2898,12 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,
{
struct sk_buff *segs, *curr, *next;
struct myri10ge_priv *mgp = netdev_priv(dev);
+ netdev_features_t features = dev->features;
struct myri10ge_slice_state *ss;
netdev_tx_t status;
- segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO6);
+ features &= ~NETIF_F_TSO6;
+ segs = skb_gso_segment(skb, features);
if (IS_ERR(segs))
goto drop;
@@ -433,7 +433,7 @@ int efx_siena_tx_tso_fallback(struct efx_tx_queue *tx_queue,
{
struct sk_buff *segments, *next;
- segments = skb_gso_segment(skb, 0);
+ segments = skb_gso_segment(skb, netdev_empty_features);
if (IS_ERR(segments))
return PTR_ERR(segments);
@@ -450,7 +450,7 @@ int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
{
struct sk_buff *segments, *next;
- segments = skb_gso_segment(skb, 0);
+ segments = skb_gso_segment(skb, netdev_empty_features);
if (IS_ERR(segments))
return PTR_ERR(segments);
@@ -1228,6 +1228,7 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,
int status;
int gso_size, gso_type, gso_segs;
int hlen = skb_transport_header(skb) - skb_mac_header(skb);
+ netedv_features_t features = dev->features;
int proto = IPPROTO_IP;
if (skb->protocol == htons(ETH_P_IP))
@@ -1274,7 +1275,8 @@ vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,
skb_shinfo(skb)->gso_size = datalen;
skb_shinfo(skb)->gso_segs = gso_segs;
}
- segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO);
+ features &= ~NETIF_F_TSO;
+ segs = skb_gso_segment(skb, features);
if (IS_ERR(segs))
goto out_dropped;
@@ -175,7 +175,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev)
if (!skb_is_gso(skb)) {
skb_mark_not_on_list(skb);
} else {
- struct sk_buff *segs = skb_gso_segment(skb, 0);
+ struct sk_buff *segs = skb_gso_segment(skb, netdev_empty_features);
if (IS_ERR(segs)) {
ret = PTR_ERR(segs);
@@ -3395,10 +3395,11 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
* work.
*/
if (features & NETIF_F_GSO_PARTIAL) {
- netdev_features_t partial_features = NETIF_F_GSO_ROBUST;
+ netdev_features_t partial_features;
struct net_device *dev = skb->dev;
- partial_features |= dev->features & dev->gso_partial_features;
+ partial_features = dev->features & dev->gso_partial_features;
+ partial_features |= NETIF_F_GSO_ROBUST;
if (!skb_gso_ok(skb, features | partial_features))
features &= ~NETIF_F_GSO_PARTIAL;
}
@@ -82,7 +82,8 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
if (unlikely(skb->len <= mss))
goto out;
- if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
+ features |= NETIF_F_GSO_ROBUST;
+ if (skb_gso_ok(skb, features)) {
/* Packet is from an untrusted source, reset gso_segs. */
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
@@ -4168,7 +4168,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
if (skb_is_gso(skb)) {
struct sk_buff *segs;
- segs = skb_gso_segment(skb, 0);
+ segs = skb_gso_segment(skb, netdev_empty_features);
if (IS_ERR(segs)) {
goto out_free;
} else if (segs) {
@@ -812,7 +812,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
return __nfqnl_enqueue_packet(net, queue, entry);
nf_bridge_adjust_skb_data(skb);
- segs = skb_gso_segment(skb, 0);
+ segs = skb_gso_segment(skb, netdev_empty_features);
/* Does not use PTR_ERR to limit the number of error codes that can be
* returned by nf_queue. For instance, callers rely on -ESRCH to
* mean 'ignore this hook'.
@@ -76,6 +76,7 @@ EXPORT_SYMBOL_GPL(nsh_pop);
static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
netdev_features_t features)
{
+ netdev_features_t tmp = netdev_empty_features;
struct sk_buff *segs = ERR_PTR(-EINVAL);
unsigned int nsh_len, mac_len;
__be16 proto;
@@ -104,7 +105,8 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
skb->mac_len = proto == htons(ETH_P_TEB) ? ETH_HLEN : 0;
skb->protocol = proto;
- features &= NETIF_F_SG;
+ tmp |= NETIF_F_SG;
+ features &= tmp;
segs = skb_mac_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) {
skb_gso_error_unwind(skb, htons(ETH_P_NSH), nsh_len,
@@ -318,13 +318,15 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
const struct dp_upcall_info *upcall_info,
uint32_t cutlen)
{
+ netdev_features_t features = netdev_empty_features;
unsigned int gso_type = skb_shinfo(skb)->gso_type;
struct sw_flow_key later_key;
struct sk_buff *segs, *nskb;
int err;
BUILD_BUG_ON(sizeof(*OVS_CB(skb)) > SKB_GSO_CB_OFFSET);
- segs = __skb_gso_segment(skb, NETIF_F_SG, false);
+ features |= NETIF_F_SG;
+ segs = __skb_gso_segment(skb, features, false);
if (IS_ERR(segs))
return PTR_ERR(segs);
if (segs == NULL)
@@ -39,6 +39,7 @@ static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,
netdev_features_t features)
{
struct sk_buff *segs = ERR_PTR(-EINVAL);
+ netdev_features_t tmp = features;
struct sctphdr *sh;
if (!skb_is_gso_sctp(skb))
@@ -50,7 +51,8 @@ static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,
__skb_pull(skb, sizeof(*sh));
- if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
+ tmp |= NETIF_F_GSO_ROBUST;
+ if (skb_gso_ok(skb, tmp)) {
/* Packet is from an untrusted source, reset gso_segs. */
struct skb_shared_info *pinfo = skb_shinfo(skb);
struct sk_buff *frag_iter;
@@ -68,7 +70,10 @@ static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,
goto out;
}
- segs = skb_segment(skb, (features | NETIF_F_HW_CSUM) & ~NETIF_F_SG);
+ tmp = features;
+ tmp |= NETIF_F_HW_CSUM;
+ tmp &= ~NETIF_F_SG;
+ segs = skb_segment(skb, tmp);
if (IS_ERR(segs))
goto out;
@@ -138,7 +138,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
struct sk_buff *segs;
/* Packet got rerouted, fixup features and segment it. */
- esp_features = esp_features & ~(NETIF_F_HW_ESP | NETIF_F_GSO_ESP);
+ esp_features &= ~NETIF_F_HW_ESP;
+ esp_features &= ~NETIF_F_GSO_ESP;
segs = skb_gso_segment(skb, esp_features);
if (IS_ERR(segs)) {
@@ -622,7 +622,7 @@ static int xfrm_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb
BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_GSO_CB_OFFSET);
BUILD_BUG_ON(sizeof(*IP6CB(skb)) > SKB_GSO_CB_OFFSET);
- segs = skb_gso_segment(skb, 0);
+ segs = skb_gso_segment(skb, netdev_empty_features);
kfree_skb(skb);
if (IS_ERR(segs))
return PTR_ERR(segs);
The xxx_gso_segment functions use netdev_features as input parameters. There are soma features handling for this parameter. Simplify these expreesions, so it can be replaced by netdev features helpers later. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 4 +++- drivers/net/ethernet/sfc/siena/tx_common.c | 2 +- drivers/net/ethernet/sfc/tx_common.c | 2 +- drivers/net/ethernet/sun/sunvnet_common.c | 4 +++- drivers/net/wireguard/device.c | 2 +- net/core/dev.c | 5 +++-- net/ipv4/tcp_offload.c | 3 ++- net/mac80211/tx.c | 2 +- net/netfilter/nfnetlink_queue.c | 2 +- net/nsh/nsh.c | 4 +++- net/openvswitch/datapath.c | 4 +++- net/sctp/offload.c | 9 +++++++-- net/xfrm/xfrm_device.c | 3 ++- net/xfrm/xfrm_output.c | 2 +- 14 files changed, 32 insertions(+), 16 deletions(-)