slave.c (cfd12c06cdceac094aab3f097cce24c279bfd43b) | slave.c (cf536ea3c7eefb26082836eb7f930b293dd38345) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/dsa/slave.c - Slave device handling 4 * Copyright (c) 2008-2009 Marvell Semiconductor 5 */ 6 7#include <linux/list.h> 8#include <linux/etherdevice.h> --- 6 unchanged lines hidden (view full) --- 15#include <linux/mdio.h> 16#include <net/rtnetlink.h> 17#include <net/pkt_cls.h> 18#include <net/selftests.h> 19#include <net/tc_act/tc_mirred.h> 20#include <linux/if_bridge.h> 21#include <linux/if_hsr.h> 22#include <linux/netpoll.h> | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/dsa/slave.c - Slave device handling 4 * Copyright (c) 2008-2009 Marvell Semiconductor 5 */ 6 7#include <linux/list.h> 8#include <linux/etherdevice.h> --- 6 unchanged lines hidden (view full) --- 15#include <linux/mdio.h> 16#include <net/rtnetlink.h> 17#include <net/pkt_cls.h> 18#include <net/selftests.h> 19#include <net/tc_act/tc_mirred.h> 20#include <linux/if_bridge.h> 21#include <linux/if_hsr.h> 22#include <linux/netpoll.h> |
23#include <linux/ptp_classify.h> | |
24 25#include "dsa_priv.h" 26 27/* slave mii_bus handling ***************************************************/ 28static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg) 29{ 30 struct dsa_switch *ds = bus->priv; 31 --- 520 unchanged lines hidden (view full) --- 552#endif 553} 554 555static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p, 556 struct sk_buff *skb) 557{ 558 struct dsa_switch *ds = p->dp->ds; 559 struct sk_buff *clone; | 23 24#include "dsa_priv.h" 25 26/* slave mii_bus handling ***************************************************/ 27static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg) 28{ 29 struct dsa_switch *ds = bus->priv; 30 --- 520 unchanged lines hidden (view full) --- 551#endif 552} 553 554static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p, 555 struct sk_buff *skb) 556{ 557 struct dsa_switch *ds = p->dp->ds; 558 struct sk_buff *clone; |
560 unsigned int type; | |
561 562 if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) 563 return; 564 | 559 560 if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) 561 return; 562 |
565 type = ptp_classify_raw(skb); 566 if (type == PTP_CLASS_NONE) 567 return; 568 | |
569 if (!ds->ops->port_txtstamp) 570 return; 571 572 clone = skb_clone_sk(skb); 573 if (!clone) 574 return; 575 | 563 if (!ds->ops->port_txtstamp) 564 return; 565 566 clone = skb_clone_sk(skb); 567 if (!clone) 568 return; 569 |
576 if (ds->ops->port_txtstamp(ds, p->dp->index, clone, type)) { | 570 if (ds->ops->port_txtstamp(ds, p->dp->index, clone)) { |
577 DSA_SKB_CB(skb)->clone = clone; 578 return; 579 } 580 581 kfree_skb(clone); 582} 583 584netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev) --- 42 unchanged lines hidden (view full) --- 627{ 628 struct dsa_slave_priv *p = netdev_priv(dev); 629 struct sk_buff *nskb; 630 631 dev_sw_netstats_tx_add(dev, 1, skb->len); 632 633 DSA_SKB_CB(skb)->clone = NULL; 634 | 571 DSA_SKB_CB(skb)->clone = clone; 572 return; 573 } 574 575 kfree_skb(clone); 576} 577 578netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev) --- 42 unchanged lines hidden (view full) --- 621{ 622 struct dsa_slave_priv *p = netdev_priv(dev); 623 struct sk_buff *nskb; 624 625 dev_sw_netstats_tx_add(dev, 1, skb->len); 626 627 DSA_SKB_CB(skb)->clone = NULL; 628 |
635 /* Identify PTP protocol packets, clone them, and pass them to the 636 * switch driver 637 */ | 629 /* Handle tx timestamp if any */ |
638 dsa_skb_tx_timestamp(p, skb); 639 640 if (dsa_realloc_skb(skb, dev)) { 641 dev_kfree_skb_any(skb); 642 return NETDEV_TX_OK; 643 } 644 645 /* needed_tailroom should still be 'warm' in the cache line from --- 1860 unchanged lines hidden --- | 630 dsa_skb_tx_timestamp(p, skb); 631 632 if (dsa_realloc_skb(skb, dev)) { 633 dev_kfree_skb_any(skb); 634 return NETDEV_TX_OK; 635 } 636 637 /* needed_tailroom should still be 'warm' in the cache line from --- 1860 unchanged lines hidden --- |