All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/15] net: get rid of unused static inlines
@ 2022-01-26 19:10 Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii() Jakub Kicinski
                   ` (15 more replies)
  0 siblings, 16 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

I noticed a couple of unused static inline functions reviewing
net/sched patches so I run a grep thru all of include/ and net/
to catch other cases. This set removes the cases which look like
obvious dead code.

Jakub Kicinski (15):
  mii: remove mii_lpa_to_linkmode_lpa_sgmii()
  nfc: use *_set_vendor_cmds() helpers
  net: remove net_invalid_timestamp()
  net: remove linkmode_change_bit()
  net: remove bond_slave_has_mac_rcu()
  net: ax25: remove route refcount
  hsr: remove get_prp_lan_id()
  ipv6: remove inet6_rsk() and tcp_twsk_ipv6only()
  dccp: remove max48()
  udp: remove inner_udp_hdr()
  udplite: remove udplite_csum_outgoing()
  netlink: remove nl_set_extack_cookie_u32()
  net: sched: remove psched_tdiff_bounded()
  net: sched: remove qdisc_qlen_cpu()
  net: tipc: remove unused static inlines

 drivers/nfc/st-nci/vendor_cmds.c   |  2 +-
 drivers/nfc/st21nfca/vendor_cmds.c |  4 +--
 include/linux/ipv6.h               |  7 -----
 include/linux/linkmode.h           |  5 ----
 include/linux/mii.h                | 17 ------------
 include/linux/netlink.h            |  9 -------
 include/linux/skbuff.h             |  5 ----
 include/linux/udp.h                |  5 ----
 include/net/ax25.h                 | 12 ---------
 include/net/bonding.h              | 14 ----------
 include/net/pkt_sched.h            |  6 -----
 include/net/sch_generic.h          |  5 ----
 include/net/udplite.h              | 43 ------------------------------
 net/ax25/ax25_route.c              |  5 ++--
 net/dccp/dccp.h                    |  5 ----
 net/hsr/hsr_main.h                 |  5 ----
 net/tipc/msg.h                     | 23 ----------------
 17 files changed, 5 insertions(+), 167 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
@ 2022-01-26 19:10 ` Jakub Kicinski
  2022-01-27 12:36   ` Vladimir Oltean
  2022-01-26 19:10 ` [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers Jakub Kicinski
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem
  Cc: netdev, Jakub Kicinski, Vladimir Oltean, Andrew Lunn,
	Heiner Kallweit, Russell King

The only caller of mii_lpa_to_linkmode_lpa_sgmii()
disappeared in v5.10.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--
CC: Vladimir Oltean <olteanv@gmail.com>
CC: Andrew Lunn <andrew@lunn.ch>
CC: Heiner Kallweit <hkallweit1@gmail.com>
CC: Russell King <linux@armlinux.org.uk>
---
 include/linux/mii.h | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/include/linux/mii.h b/include/linux/mii.h
index 12ea29e04293..b8a1a17a87dd 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -387,23 +387,6 @@ mii_lpa_mod_linkmode_lpa_sgmii(unsigned long *lp_advertising, u32 lpa)
 			 speed_duplex == LPA_SGMII_10FULL);
 }
 
-/**
- * mii_lpa_to_linkmode_adv_sgmii
- * @advertising: pointer to destination link mode.
- * @lpa: value of the MII_LPA register
- *
- * A small helper function that translates MII_ADVERTISE bits
- * to linkmode advertisement settings when in SGMII mode.
- * Clears the old value of advertising.
- */
-static inline void mii_lpa_to_linkmode_lpa_sgmii(unsigned long *lp_advertising,
-						 u32 lpa)
-{
-	linkmode_zero(lp_advertising);
-
-	mii_lpa_mod_linkmode_lpa_sgmii(lp_advertising, lpa);
-}
-
 /**
  * mii_adv_mod_linkmode_adv_t
  * @advertising:pointer to destination link mode.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii() Jakub Kicinski
@ 2022-01-26 19:10 ` Jakub Kicinski
  2022-01-27  7:30   ` Krzysztof Kozlowski
  2022-01-26 19:10 ` [PATCH net-next 03/15] net: remove net_invalid_timestamp() Jakub Kicinski
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, krzysztof.kozlowski, wengjianfeng

NCI and HCI wrappers for nfc_set_vendor_cmds() exist,
use them. We could also remove the helpers.
It's a coin toss.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: krzysztof.kozlowski@canonical.com
CC: wengjianfeng@yulong.com
---
 drivers/nfc/st-nci/vendor_cmds.c   | 2 +-
 drivers/nfc/st21nfca/vendor_cmds.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/st-nci/vendor_cmds.c b/drivers/nfc/st-nci/vendor_cmds.c
index 30d2912d1a05..6335d7afca24 100644
--- a/drivers/nfc/st-nci/vendor_cmds.c
+++ b/drivers/nfc/st-nci/vendor_cmds.c
@@ -456,7 +456,7 @@ static const struct nfc_vendor_cmd st_nci_vendor_cmds[] = {
 
 int st_nci_vendor_cmds_init(struct nci_dev *ndev)
 {
-	return nfc_set_vendor_cmds(ndev->nfc_dev, st_nci_vendor_cmds,
+	return nci_set_vendor_cmds(ndev, st_nci_vendor_cmds,
 				   sizeof(st_nci_vendor_cmds));
 }
 EXPORT_SYMBOL(st_nci_vendor_cmds_init);
diff --git a/drivers/nfc/st21nfca/vendor_cmds.c b/drivers/nfc/st21nfca/vendor_cmds.c
index 74882866dbaf..bfa418d4c6b0 100644
--- a/drivers/nfc/st21nfca/vendor_cmds.c
+++ b/drivers/nfc/st21nfca/vendor_cmds.c
@@ -358,7 +358,7 @@ int st21nfca_vendor_cmds_init(struct nfc_hci_dev *hdev)
 	struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
 
 	init_completion(&info->vendor_info.req_completion);
-	return nfc_set_vendor_cmds(hdev->ndev, st21nfca_vendor_cmds,
-				   sizeof(st21nfca_vendor_cmds));
+	return nfc_hci_set_vendor_cmds(hdev, st21nfca_vendor_cmds,
+				       sizeof(st21nfca_vendor_cmds));
 }
 EXPORT_SYMBOL(st21nfca_vendor_cmds_init);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 03/15] net: remove net_invalid_timestamp()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii() Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers Jakub Kicinski
@ 2022-01-26 19:10 ` Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 04/15] net: remove linkmode_change_bit() Jakub Kicinski
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

No callers since v3.15.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/linux/skbuff.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8131d0de7559..60bd2347708c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3899,11 +3899,6 @@ static inline ktime_t net_timedelta(ktime_t t)
 	return ktime_sub(ktime_get_real(), t);
 }
 
-static inline ktime_t net_invalid_timestamp(void)
-{
-	return 0;
-}
-
 static inline u8 skb_metadata_len(const struct sk_buff *skb)
 {
 	return skb_shinfo(skb)->meta_len;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 04/15] net: remove linkmode_change_bit()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (2 preceding siblings ...)
  2022-01-26 19:10 ` [PATCH net-next 03/15] net: remove net_invalid_timestamp() Jakub Kicinski
@ 2022-01-26 19:10 ` Jakub Kicinski
  2022-01-26 19:10 ` [PATCH net-next 05/15] net: remove bond_slave_has_mac_rcu() Jakub Kicinski
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Andrew Lunn, Heiner Kallweit, Russell King

No callers since v5.7, the initial use case seems pretty
esoteric so removing this should not harm the completeness
of the API.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: Andrew Lunn <andrew@lunn.ch>
CC: Heiner Kallweit <hkallweit1@gmail.com>
CC: Russell King <linux@armlinux.org.uk>
---
 include/linux/linkmode.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h
index f8397f300fcd..15e0e0209da4 100644
--- a/include/linux/linkmode.h
+++ b/include/linux/linkmode.h
@@ -66,11 +66,6 @@ static inline void linkmode_mod_bit(int nr, volatile unsigned long *addr,
 		linkmode_clear_bit(nr, addr);
 }
 
-static inline void linkmode_change_bit(int nr, volatile unsigned long *addr)
-{
-	__change_bit(nr, addr);
-}
-
 static inline int linkmode_test_bit(int nr, const volatile unsigned long *addr)
 {
 	return test_bit(nr, addr);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 05/15] net: remove bond_slave_has_mac_rcu()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (3 preceding siblings ...)
  2022-01-26 19:10 ` [PATCH net-next 04/15] net: remove linkmode_change_bit() Jakub Kicinski
@ 2022-01-26 19:10 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 06/15] net: ax25: remove route refcount Jakub Kicinski
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, j.vosburgh, vfalico, andy

No caller since v3.16.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: j.vosburgh@gmail.com
CC: vfalico@gmail.com
CC: andy@greyhouse.net
---
 include/net/bonding.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/net/bonding.h b/include/net/bonding.h
index 83cfd2d70247..7dead855a72d 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -698,20 +698,6 @@ static inline struct slave *bond_slave_has_mac(struct bonding *bond,
 	return NULL;
 }
 
-/* Caller must hold rcu_read_lock() for read */
-static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond,
-					       const u8 *mac)
-{
-	struct list_head *iter;
-	struct slave *tmp;
-
-	bond_for_each_slave_rcu(bond, tmp, iter)
-		if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
-			return tmp;
-
-	return NULL;
-}
-
 /* Caller must hold rcu_read_lock() for read */
 static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 06/15] net: ax25: remove route refcount
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (4 preceding siblings ...)
  2022-01-26 19:10 ` [PATCH net-next 05/15] net: remove bond_slave_has_mac_rcu() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-27  9:18   ` Thomas Osterried
  2022-01-26 19:11 ` [PATCH net-next 07/15] hsr: remove get_prp_lan_id() Jakub Kicinski
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, ralf, linux-hams

Nothing takes the refcount since v4.9.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: ralf@linux-mips.org
CC: linux-hams@vger.kernel.org
---
 include/net/ax25.h    | 12 ------------
 net/ax25/ax25_route.c |  5 ++---
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/include/net/ax25.h b/include/net/ax25.h
index 526e49589197..cb628c5d7c5b 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -187,18 +187,12 @@ typedef struct {
 
 typedef struct ax25_route {
 	struct ax25_route	*next;
-	refcount_t		refcount;
 	ax25_address		callsign;
 	struct net_device	*dev;
 	ax25_digi		*digipeat;
 	char			ip_mode;
 } ax25_route;
 
-static inline void ax25_hold_route(ax25_route *ax25_rt)
-{
-	refcount_inc(&ax25_rt->refcount);
-}
-
 void __ax25_put_route(ax25_route *ax25_rt);
 
 extern rwlock_t ax25_route_lock;
@@ -213,12 +207,6 @@ static inline void ax25_route_lock_unuse(void)
 	read_unlock(&ax25_route_lock);
 }
 
-static inline void ax25_put_route(ax25_route *ax25_rt)
-{
-	if (refcount_dec_and_test(&ax25_rt->refcount))
-		__ax25_put_route(ax25_rt);
-}
-
 typedef struct {
 	char			slave;			/* slave_mode?   */
 	struct timer_list	slave_timer;		/* timeout timer */
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index d0b2e094bd55..be97dc6a53cb 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -111,7 +111,6 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
 		return -ENOMEM;
 	}
 
-	refcount_set(&ax25_rt->refcount, 1);
 	ax25_rt->callsign     = route->dest_addr;
 	ax25_rt->dev          = ax25_dev->dev;
 	ax25_rt->digipeat     = NULL;
@@ -160,12 +159,12 @@ static int ax25_rt_del(struct ax25_routes_struct *route)
 		    ax25cmp(&route->dest_addr, &s->callsign) == 0) {
 			if (ax25_route_list == s) {
 				ax25_route_list = s->next;
-				ax25_put_route(s);
+				__ax25_put_route(s);
 			} else {
 				for (t = ax25_route_list; t != NULL; t = t->next) {
 					if (t->next == s) {
 						t->next = s->next;
-						ax25_put_route(s);
+						__ax25_put_route(s);
 						break;
 					}
 				}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 07/15] hsr: remove get_prp_lan_id()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (5 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 06/15] net: ax25: remove route refcount Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 08/15] ipv6: remove inet6_rsk() and tcp_twsk_ipv6only() Jakub Kicinski
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, george.mccollister, ennoerlangen

get_prp_lan_id() has never been used.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: george.mccollister@gmail.com
CC: ennoerlangen@gmail.com
---
 net/hsr/hsr_main.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
index 043e4e9a1694..ff9ec7634218 100644
--- a/net/hsr/hsr_main.h
+++ b/net/hsr/hsr_main.h
@@ -259,11 +259,6 @@ static inline u16 prp_get_skb_sequence_nr(struct prp_rct *rct)
 	return ntohs(rct->sequence_nr);
 }
 
-static inline u16 get_prp_lan_id(struct prp_rct *rct)
-{
-	return ntohs(rct->lan_id_and_LSDU_size) >> 12;
-}
-
 /* assume there is a valid rct */
 static inline bool prp_check_lsdu_size(struct sk_buff *skb,
 				       struct prp_rct *rct,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 08/15] ipv6: remove inet6_rsk() and tcp_twsk_ipv6only()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (6 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 07/15] hsr: remove get_prp_lan_id() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11   ` Jakub Kicinski
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, dsahern, justin.iurman

The stubs under !CONFIG_IPV6 were missed when real functions
got deleted ca. v3.13.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: dsahern@kernel.org
CC: justin.iurman@uliege.be
---
 include/linux/ipv6.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a59d25f19385..1e0f8a31f3de 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -371,19 +371,12 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
 	return NULL;
 }
 
-static inline struct inet6_request_sock *
-			inet6_rsk(const struct request_sock *rsk)
-{
-	return NULL;
-}
-
 static inline struct raw6_sock *raw6_sk(const struct sock *sk)
 {
 	return NULL;
 }
 
 #define inet6_rcv_saddr(__sk)	NULL
-#define tcp_twsk_ipv6only(__sk)		0
 #define inet_v6_ipv6only(__sk)		0
 #endif /* IS_ENABLED(CONFIG_IPV6) */
 #endif /* _IPV6_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 09/15] dccp: remove max48()
@ 2022-01-26 19:11   ` Jakub Kicinski
  0 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, rdunlap, ncardwell, edumazet, dccp

Not used since v2.6.37.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: rdunlap@infradead.org
CC: ncardwell@google.com
CC: edumazet@google.com
CC: dccp@vger.kernel.org
---
 net/dccp/dccp.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 5183e627468d..671c377f0889 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -136,11 +136,6 @@ static inline int between48(const u64 seq1, const u64 seq2, const u64 seq3)
 	return (seq3 << 16) - (seq2 << 16) >= (seq1 << 16) - (seq2 << 16);
 }
 
-static inline u64 max48(const u64 seq1, const u64 seq2)
-{
-	return after48(seq1, seq2) ? seq1 : seq2;
-}
-
 /**
  * dccp_loss_count - Approximate the number of lost data packets in a burst loss
  * @s1:  last known sequence number before the loss ('hole')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 09/15] dccp: remove max48()
@ 2022-01-26 19:11   ` Jakub Kicinski
  0 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: dccp

Not used since v2.6.37.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: rdunlap@infradead.org
CC: ncardwell@google.com
CC: edumazet@google.com
CC: dccp@vger.kernel.org
---
 net/dccp/dccp.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 5183e627468d..671c377f0889 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -136,11 +136,6 @@ static inline int between48(const u64 seq1, const u64 seq2, const u64 seq3)
 	return (seq3 << 16) - (seq2 << 16) >= (seq1 << 16) - (seq2 << 16);
 }
 
-static inline u64 max48(const u64 seq1, const u64 seq2)
-{
-	return after48(seq1, seq2) ? seq1 : seq2;
-}
-
 /**
  * dccp_loss_count - Approximate the number of lost data packets in a burst loss
  * @s1:  last known sequence number before the loss ('hole')
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 10/15] udp: remove inner_udp_hdr()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (8 preceding siblings ...)
  2022-01-26 19:11   ` Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:36   ` Willem de Bruijn
  2022-01-26 19:11 ` [PATCH net-next 11/15] udplite: remove udplite_csum_outgoing() Jakub Kicinski
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, pabeni, willemb

Not used since added in v3.8.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: pabeni@redhat.com
CC: willemb@google.com
---
 include/linux/udp.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/linux/udp.h b/include/linux/udp.h
index ae66dadd8543..254a2654400f 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -23,11 +23,6 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
 	return (struct udphdr *)skb_transport_header(skb);
 }
 
-static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
-{
-	return (struct udphdr *)skb_inner_transport_header(skb);
-}
-
 #define UDP_HTABLE_SIZE_MIN		(CONFIG_BASE_SMALL ? 128 : 256)
 
 static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 11/15] udplite: remove udplite_csum_outgoing()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (9 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 10/15] udp: remove inner_udp_hdr() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 12/15] netlink: remove nl_set_extack_cookie_u32() Jakub Kicinski
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

Not used since v4.0.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/net/udplite.h | 43 -------------------------------------------
 1 file changed, 43 deletions(-)

diff --git a/include/net/udplite.h b/include/net/udplite.h
index 9185e45b997f..a3c53110d30b 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -70,49 +70,6 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
 	return 0;
 }
 
-/* Slow-path computation of checksum. Socket is locked. */
-static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
-{
-	const struct udp_sock *up = udp_sk(skb->sk);
-	int cscov = up->len;
-	__wsum csum = 0;
-
-	if (up->pcflag & UDPLITE_SEND_CC) {
-		/*
-		 * Sender has set `partial coverage' option on UDP-Lite socket.
-		 * The special case "up->pcslen == 0" signifies full coverage.
-		 */
-		if (up->pcslen < up->len) {
-			if (0 < up->pcslen)
-				cscov = up->pcslen;
-			udp_hdr(skb)->len = htons(up->pcslen);
-		}
-		/*
-		 * NOTE: Causes for the error case  `up->pcslen > up->len':
-		 *        (i)  Application error (will not be penalized).
-		 *       (ii)  Payload too big for send buffer: data is split
-		 *             into several packets, each with its own header.
-		 *             In this case (e.g. last segment), coverage may
-		 *             exceed packet length.
-		 *       Since packets with coverage length > packet length are
-		 *       illegal, we fall back to the defaults here.
-		 */
-	}
-
-	skb->ip_summed = CHECKSUM_NONE;     /* no HW support for checksumming */
-
-	skb_queue_walk(&sk->sk_write_queue, skb) {
-		const int off = skb_transport_offset(skb);
-		const int len = skb->len - off;
-
-		csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
-
-		if ((cscov -= len) <= 0)
-			break;
-	}
-	return csum;
-}
-
 /* Fast-path computation of checksum. Socket may not be locked. */
 static inline __wsum udplite_csum(struct sk_buff *skb)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 12/15] netlink: remove nl_set_extack_cookie_u32()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (10 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 11/15] udplite: remove udplite_csum_outgoing() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 13/15] net: sched: remove psched_tdiff_bounded() Jakub Kicinski
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

Not used since v5.10.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/linux/netlink.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 1ec631838af9..bda1c385cffb 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -135,15 +135,6 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
 	extack->cookie_len = sizeof(cookie);
 }
 
-static inline void nl_set_extack_cookie_u32(struct netlink_ext_ack *extack,
-					    u32 cookie)
-{
-	if (!extack)
-		return;
-	memcpy(extack->cookie, &cookie, sizeof(cookie));
-	extack->cookie_len = sizeof(cookie);
-}
-
 void netlink_kernel_release(struct sock *sk);
 int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
 int netlink_change_ngroups(struct sock *sk, unsigned int groups);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 13/15] net: sched: remove psched_tdiff_bounded()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (11 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 12/15] netlink: remove nl_set_extack_cookie_u32() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 14/15] net: sched: remove qdisc_qlen_cpu() Jakub Kicinski
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, jhs, xiyou.wangcong, jiri

Not used since v3.9.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jhs@mojatatu.com
CC: xiyou.wangcong@gmail.com
CC: jiri@resnulli.us
---
 include/net/pkt_sched.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 9e7b21c0b3a6..44a35531952e 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -63,12 +63,6 @@ static inline psched_time_t psched_get_time(void)
 	return PSCHED_NS2TICKS(ktime_get_ns());
 }
 
-static inline psched_tdiff_t
-psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
-{
-	return min(tv1 - tv2, bound);
-}
-
 struct qdisc_watchdog {
 	u64		last_expires;
 	struct hrtimer	timer;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 14/15] net: sched: remove qdisc_qlen_cpu()
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (12 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 13/15] net: sched: remove psched_tdiff_bounded() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-26 19:11 ` [PATCH net-next 15/15] net: tipc: remove unused static inlines Jakub Kicinski
  2022-01-27 14:20 ` [PATCH net-next 00/15] net: get rid of " patchwork-bot+netdevbpf
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

Never used since it was added in v5.2.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/net/sch_generic.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 472843eedbae..9bab396c1f3b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -518,11 +518,6 @@ static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
 	BUILD_BUG_ON(sizeof(qcb->data) < sz);
 }
 
-static inline int qdisc_qlen_cpu(const struct Qdisc *q)
-{
-	return this_cpu_ptr(q->cpu_qstats)->qlen;
-}
-
 static inline int qdisc_qlen(const struct Qdisc *q)
 {
 	return q->q.qlen;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH net-next 15/15] net: tipc: remove unused static inlines
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (13 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 14/15] net: sched: remove qdisc_qlen_cpu() Jakub Kicinski
@ 2022-01-26 19:11 ` Jakub Kicinski
  2022-01-27 14:20 ` [PATCH net-next 00/15] net: get rid of " patchwork-bot+netdevbpf
  15 siblings, 0 replies; 24+ messages in thread
From: Jakub Kicinski @ 2022-01-26 19:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, jmaloy, ying.xue, tipc-discussion

IIUC the TIPC msg helpers are not meant to provide
and exhaustive API, so remove the unused ones.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jmaloy@redhat.com
CC: ying.xue@windriver.com
CC: tipc-discussion@lists.sourceforge.net
---
 net/tipc/msg.h | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 64ae4c4c44f8..c5eec16213d7 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -226,14 +226,6 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
 	m->hdr[w] |= htonl(val);
 }
 
-static inline void msg_swap_words(struct tipc_msg *msg, u32 a, u32 b)
-{
-	u32 temp = msg->hdr[a];
-
-	msg->hdr[a] = msg->hdr[b];
-	msg->hdr[b] = temp;
-}
-
 /*
  * Word 0
  */
@@ -480,11 +472,6 @@ static inline void msg_incr_reroute_cnt(struct tipc_msg *m)
 	msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1);
 }
 
-static inline void msg_reset_reroute_cnt(struct tipc_msg *m)
-{
-	msg_set_bits(m, 1, 21, 0xf, 0);
-}
-
 static inline u32 msg_lookup_scope(struct tipc_msg *m)
 {
 	return msg_bits(m, 1, 19, 0x3);
@@ -800,11 +787,6 @@ static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n)
 	msg_set_word(m, 2, n);
 }
 
-static inline u32 msg_bcgap_after(struct tipc_msg *m)
-{
-	return msg_bits(m, 2, 16, 0xffff);
-}
-
 static inline void msg_set_bcgap_after(struct tipc_msg *m, u32 n)
 {
 	msg_set_bits(m, 2, 16, 0xffff, n);
@@ -868,11 +850,6 @@ static inline void msg_set_next_sent(struct tipc_msg *m, u16 n)
 	msg_set_bits(m, 4, 0, 0xffff, n);
 }
 
-static inline void msg_set_long_msgno(struct tipc_msg *m, u32 n)
-{
-	msg_set_bits(m, 4, 0, 0xffff, n);
-}
-
 static inline u32 msg_bc_netid(struct tipc_msg *m)
 {
 	return msg_word(m, 4);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 10/15] udp: remove inner_udp_hdr()
  2022-01-26 19:11 ` [PATCH net-next 10/15] udp: remove inner_udp_hdr() Jakub Kicinski
@ 2022-01-26 19:36   ` Willem de Bruijn
  0 siblings, 0 replies; 24+ messages in thread
From: Willem de Bruijn @ 2022-01-26 19:36 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, pabeni

On Wed, Jan 26, 2022 at 2:11 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> Not used since added in v3.8.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Acked-by: Willem de Bruijn <willemb@google.com>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers
  2022-01-26 19:10 ` [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers Jakub Kicinski
@ 2022-01-27  7:30   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2022-01-27  7:30 UTC (permalink / raw)
  To: Jakub Kicinski, davem; +Cc: netdev, wengjianfeng

On 26/01/2022 20:10, Jakub Kicinski wrote:
> NCI and HCI wrappers for nfc_set_vendor_cmds() exist,
> use them. We could also remove the helpers.
> It's a coin toss.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: krzysztof.kozlowski@canonical.com
> CC: wengjianfeng@yulong.com
> ---
>  drivers/nfc/st-nci/vendor_cmds.c   | 2 +-
>  drivers/nfc/st21nfca/vendor_cmds.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 06/15] net: ax25: remove route refcount
  2022-01-26 19:11 ` [PATCH net-next 06/15] net: ax25: remove route refcount Jakub Kicinski
@ 2022-01-27  9:18   ` Thomas Osterried
  2022-01-27 15:58     ` David Ranch
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Osterried @ 2022-01-27  9:18 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, ralf, linux-hams

Hello,

 think it's absolutely correct to state
  "Nothing takes the refcount since v4.9."
because in ax25_rt_add(),
  refcount_set(&ax25_rt->refcount, 1);
is used (for every new ax25_rt entry).

But nothing does an increment.
There's one function in include/net/ax25.h ,
  ax25_hold_route() which would refcount_inc(&ax25_rt->refcount)
but it's not called from anywhere.

=> It's value is always 1, and the deleting function ax25_put_route() decrements it again before freeing.
   I also see no sense in this (anymore).


Every struct ax25_route_list operation is assured with either
  write_lock_bh(&ax25_route_lock);
  write_unlock_bh(&ax25_route_lock);
or
  the struct ax25_route returned from functions is assured by calling read_lock(&ax25_route_lock).

-> No refcount is needed.


=> It's good to tidy up stuff that's needed anymore.

But keep in mind:
The code has strong similarities with include/net/x25.h and x25/x25_route.c ,
especially in the parts of ax25_hold_route() and ax25_rt_add().
This will get lost.


But there a things a bot does not know: human readable senteces.
ax25_get_route() is introduced with:

  /*
   *      Find AX.25 route
   *
   *      Only routes with a reference count of zero can be destroyed.
   *      Must be called with ax25_route_lock read locked.
   */

The first sentence informs: ax25_rt entries may be freed during the ax25_route_list operation.
It mentiones reference count (which will exist anymore).
The conclusion of the first sentence is "Must be called with ax25_route_lock read locked.". This is still true and assured.
I don't think it has to explain why the read lock is necessary (it's obvious, that routes could be deleted or added to the list). ->

  /*
   *      Find AX.25 route
   *
   *      Must be called with ax25_route_lock read locked.
   */

should be enough.

ff-topic:
=========

About read_lock)(): Inconsistent use.
It's
  directly called,
and by
  ax25_route_lock_use(), which calls read_lock():
  {
          read_lock(&ax25_route_lock);
  }

This makes the code harder to read.
There's also a function ax25_rt_seq_stop() that calls read_unlock() instead of calling ax25_route_lock_unuse(), which does the same.


vy 73,
	- Thomas  dl9sau

On Wed, Jan 26, 2022 at 11:11:00AM -0800, Jakub Kicinski wrote:
> Nothing takes the refcount since v4.9.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: ralf@linux-mips.org
> CC: linux-hams@vger.kernel.org
> ---
>  include/net/ax25.h    | 12 ------------
>  net/ax25/ax25_route.c |  5 ++---
>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/include/net/ax25.h b/include/net/ax25.h
> index 526e49589197..cb628c5d7c5b 100644
> --- a/include/net/ax25.h
> +++ b/include/net/ax25.h
> @@ -187,18 +187,12 @@ typedef struct {
>  
>  typedef struct ax25_route {
>  	struct ax25_route	*next;
> -	refcount_t		refcount;
>  	ax25_address		callsign;
>  	struct net_device	*dev;
>  	ax25_digi		*digipeat;
>  	char			ip_mode;
>  } ax25_route;
>  
> -static inline void ax25_hold_route(ax25_route *ax25_rt)
> -{
> -	refcount_inc(&ax25_rt->refcount);
> -}
> -
>  void __ax25_put_route(ax25_route *ax25_rt);
>  
>  extern rwlock_t ax25_route_lock;
> @@ -213,12 +207,6 @@ static inline void ax25_route_lock_unuse(void)
>  	read_unlock(&ax25_route_lock);
>  }
>  
> -static inline void ax25_put_route(ax25_route *ax25_rt)
> -{
> -	if (refcount_dec_and_test(&ax25_rt->refcount))
> -		__ax25_put_route(ax25_rt);
> -}
> -
>  typedef struct {
>  	char			slave;			/* slave_mode?   */
>  	struct timer_list	slave_timer;		/* timeout timer */
> diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
> index d0b2e094bd55..be97dc6a53cb 100644
> --- a/net/ax25/ax25_route.c
> +++ b/net/ax25/ax25_route.c
> @@ -111,7 +111,6 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
>  		return -ENOMEM;
>  	}
>  
> -	refcount_set(&ax25_rt->refcount, 1);
>  	ax25_rt->callsign     = route->dest_addr;
>  	ax25_rt->dev          = ax25_dev->dev;
>  	ax25_rt->digipeat     = NULL;
> @@ -160,12 +159,12 @@ static int ax25_rt_del(struct ax25_routes_struct *route)
>  		    ax25cmp(&route->dest_addr, &s->callsign) == 0) {
>  			if (ax25_route_list == s) {
>  				ax25_route_list = s->next;
> -				ax25_put_route(s);
> +				__ax25_put_route(s);
>  			} else {
>  				for (t = ax25_route_list; t != NULL; t = t->next) {
>  					if (t->next == s) {
>  						t->next = s->next;
> -						ax25_put_route(s);
> +						__ax25_put_route(s);
>  						break;
>  					}
>  				}
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii()
  2022-01-26 19:10 ` [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii() Jakub Kicinski
@ 2022-01-27 12:36   ` Vladimir Oltean
  0 siblings, 0 replies; 24+ messages in thread
From: Vladimir Oltean @ 2022-01-27 12:36 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, Andrew Lunn, Heiner Kallweit, Russell King

On Wed, Jan 26, 2022 at 11:10:55AM -0800, Jakub Kicinski wrote:
> The only caller of mii_lpa_to_linkmode_lpa_sgmii()
> disappeared in v5.10.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> --
> CC: Vladimir Oltean <olteanv@gmail.com>
> CC: Andrew Lunn <andrew@lunn.ch>
> CC: Heiner Kallweit <hkallweit1@gmail.com>
> CC: Russell King <linux@armlinux.org.uk>
> ---
>  include/linux/mii.h | 17 -----------------
>  1 file changed, 17 deletions(-)
> 
> diff --git a/include/linux/mii.h b/include/linux/mii.h
> index 12ea29e04293..b8a1a17a87dd 100644
> --- a/include/linux/mii.h
> +++ b/include/linux/mii.h
> @@ -387,23 +387,6 @@ mii_lpa_mod_linkmode_lpa_sgmii(unsigned long *lp_advertising, u32 lpa)
>  			 speed_duplex == LPA_SGMII_10FULL);
>  }
>  
> -/**
> - * mii_lpa_to_linkmode_adv_sgmii
> - * @advertising: pointer to destination link mode.
> - * @lpa: value of the MII_LPA register
> - *
> - * A small helper function that translates MII_ADVERTISE bits
> - * to linkmode advertisement settings when in SGMII mode.
> - * Clears the old value of advertising.
> - */
> -static inline void mii_lpa_to_linkmode_lpa_sgmii(unsigned long *lp_advertising,
> -						 u32 lpa)
> -{
> -	linkmode_zero(lp_advertising);
> -
> -	mii_lpa_mod_linkmode_lpa_sgmii(lp_advertising, lpa);
> -}
> -

This is also the only caller of mii_lpa_mod_linkmode_lpa_sgmii(), so
that function can be deleted too.

>  /**
>   * mii_adv_mod_linkmode_adv_t
>   * @advertising:pointer to destination link mode.
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 00/15] net: get rid of unused static inlines
  2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
                   ` (14 preceding siblings ...)
  2022-01-26 19:11 ` [PATCH net-next 15/15] net: tipc: remove unused static inlines Jakub Kicinski
@ 2022-01-27 14:20 ` patchwork-bot+netdevbpf
  15 siblings, 0 replies; 24+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-27 14:20 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 26 Jan 2022 11:10:54 -0800 you wrote:
> I noticed a couple of unused static inline functions reviewing
> net/sched patches so I run a grep thru all of include/ and net/
> to catch other cases. This set removes the cases which look like
> obvious dead code.
> 
> Jakub Kicinski (15):
>   mii: remove mii_lpa_to_linkmode_lpa_sgmii()
>   nfc: use *_set_vendor_cmds() helpers
>   net: remove net_invalid_timestamp()
>   net: remove linkmode_change_bit()
>   net: remove bond_slave_has_mac_rcu()
>   net: ax25: remove route refcount
>   hsr: remove get_prp_lan_id()
>   ipv6: remove inet6_rsk() and tcp_twsk_ipv6only()
>   dccp: remove max48()
>   udp: remove inner_udp_hdr()
>   udplite: remove udplite_csum_outgoing()
>   netlink: remove nl_set_extack_cookie_u32()
>   net: sched: remove psched_tdiff_bounded()
>   net: sched: remove qdisc_qlen_cpu()
>   net: tipc: remove unused static inlines
> 
> [...]

Here is the summary with links:
  - [net-next,01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii()
    https://git.kernel.org/netdev/net-next/c/bd5daba2d024
  - [net-next,02/15] nfc: use *_set_vendor_cmds() helpers
    https://git.kernel.org/netdev/net-next/c/f7bfd110f168
  - [net-next,03/15] net: remove net_invalid_timestamp()
    https://git.kernel.org/netdev/net-next/c/b1755400b4be
  - [net-next,04/15] net: remove linkmode_change_bit()
    https://git.kernel.org/netdev/net-next/c/08dfa5a19e1f
  - [net-next,05/15] net: remove bond_slave_has_mac_rcu()
    https://git.kernel.org/netdev/net-next/c/8b0fdcdc3a7d
  - [net-next,06/15] net: ax25: remove route refcount
    https://git.kernel.org/netdev/net-next/c/560e08eda796
  - [net-next,07/15] hsr: remove get_prp_lan_id()
    https://git.kernel.org/netdev/net-next/c/0ab1e6d9a453
  - [net-next,08/15] ipv6: remove inet6_rsk() and tcp_twsk_ipv6only()
    https://git.kernel.org/netdev/net-next/c/8b2d546e23bb
  - [net-next,09/15] dccp: remove max48()
    https://git.kernel.org/netdev/net-next/c/1303f8f0df24
  - [net-next,10/15] udp: remove inner_udp_hdr()
    https://git.kernel.org/netdev/net-next/c/cc81df835c25
  - [net-next,11/15] udplite: remove udplite_csum_outgoing()
    https://git.kernel.org/netdev/net-next/c/937fca918aac
  - [net-next,12/15] netlink: remove nl_set_extack_cookie_u32()
    https://git.kernel.org/netdev/net-next/c/d59a67f2f3f3
  - [net-next,13/15] net: sched: remove psched_tdiff_bounded()
    https://git.kernel.org/netdev/net-next/c/98b608629746
  - [net-next,14/15] net: sched: remove qdisc_qlen_cpu()
    https://git.kernel.org/netdev/net-next/c/a459bc9a3a68
  - [net-next,15/15] net: tipc: remove unused static inlines
    https://git.kernel.org/netdev/net-next/c/5e4eca5d929a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 06/15] net: ax25: remove route refcount
  2022-01-27  9:18   ` Thomas Osterried
@ 2022-01-27 15:58     ` David Ranch
  2022-01-28 10:21       ` Dan Carpenter
  0 siblings, 1 reply; 24+ messages in thread
From: David Ranch @ 2022-01-27 15:58 UTC (permalink / raw)
  To: Thomas Osterried, Jakub Kicinski; +Cc: davem, netdev, ralf, linux-hams


Curious, has this change been tested with an actual testbed to confirm 
it doesn't break anything?  We *have* to stop allowing good intentioned 
but naive developers from submitting patches when they've never tested 
the resulting change.

--David
KI6ZHD


On 01/27/2022 01:18 AM, Thomas Osterried wrote:
> Hello,
>
>   think it's absolutely correct to state
>    "Nothing takes the refcount since v4.9."
> because in ax25_rt_add(),
>    refcount_set(&ax25_rt->refcount, 1);
> is used (for every new ax25_rt entry).
>
> But nothing does an increment.
> There's one function in include/net/ax25.h ,
>    ax25_hold_route() which would refcount_inc(&ax25_rt->refcount)
> but it's not called from anywhere.
>
> => It's value is always 1, and the deleting function ax25_put_route() decrements it again before freeing.
>     I also see no sense in this (anymore).
>
>
> Every struct ax25_route_list operation is assured with either
>    write_lock_bh(&ax25_route_lock);
>    write_unlock_bh(&ax25_route_lock);
> or
>    the struct ax25_route returned from functions is assured by calling read_lock(&ax25_route_lock).
>
> -> No refcount is needed.
>
>
> => It's good to tidy up stuff that's needed anymore.
>
> But keep in mind:
> The code has strong similarities with include/net/x25.h and x25/x25_route.c ,
> especially in the parts of ax25_hold_route() and ax25_rt_add().
> This will get lost.
>
>
> But there a things a bot does not know: human readable senteces.
> ax25_get_route() is introduced with:
>
>    /*
>     *      Find AX.25 route
>     *
>     *      Only routes with a reference count of zero can be destroyed.
>     *      Must be called with ax25_route_lock read locked.
>     */
>
> The first sentence informs: ax25_rt entries may be freed during the ax25_route_list operation.
> It mentiones reference count (which will exist anymore).
> The conclusion of the first sentence is "Must be called with ax25_route_lock read locked.". This is still true and assured.
> I don't think it has to explain why the read lock is necessary (it's obvious, that routes could be deleted or added to the list). ->
>
>    /*
>     *      Find AX.25 route
>     *
>     *      Must be called with ax25_route_lock read locked.
>     */
>
> should be enough.
>
> ff-topic:
> =========
>
> About read_lock)(): Inconsistent use.
> It's
>    directly called,
> and by
>    ax25_route_lock_use(), which calls read_lock():
>    {
>            read_lock(&ax25_route_lock);
>    }
>
> This makes the code harder to read.
> There's also a function ax25_rt_seq_stop() that calls read_unlock() instead of calling ax25_route_lock_unuse(), which does the same.
>
>
> vy 73,
> 	- Thomas  dl9sau
>
> On Wed, Jan 26, 2022 at 11:11:00AM -0800, Jakub Kicinski wrote:
>> Nothing takes the refcount since v4.9.
>>
>> Signed-off-by: Jakub Kicinski<kuba@kernel.org>
>> ---
>> CC:ralf@linux-mips.org
>> CC:linux-hams@vger.kernel.org
>> ---
>>   include/net/ax25.h    | 12 ------------
>>   net/ax25/ax25_route.c |  5 ++---
>>   2 files changed, 2 insertions(+), 15 deletions(-)
>>
>> diff --git a/include/net/ax25.h b/include/net/ax25.h
>> index 526e49589197..cb628c5d7c5b 100644
>> --- a/include/net/ax25.h
>> +++ b/include/net/ax25.h
>> @@ -187,18 +187,12 @@ typedef struct {
>>   
>>   typedef struct ax25_route {
>>   	struct ax25_route	*next;
>> -	refcount_t		refcount;
>>   	ax25_address		callsign;
>>   	struct net_device	*dev;
>>   	ax25_digi		*digipeat;
>>   	char			ip_mode;
>>   } ax25_route;
>>   
>> -static inline void ax25_hold_route(ax25_route *ax25_rt)
>> -{
>> -	refcount_inc(&ax25_rt->refcount);
>> -}
>> -
>>   void __ax25_put_route(ax25_route *ax25_rt);
>>   
>>   extern rwlock_t ax25_route_lock;
>> @@ -213,12 +207,6 @@ static inline void ax25_route_lock_unuse(void)
>>   	read_unlock(&ax25_route_lock);
>>   }
>>   
>> -static inline void ax25_put_route(ax25_route *ax25_rt)
>> -{
>> -	if (refcount_dec_and_test(&ax25_rt->refcount))
>> -		__ax25_put_route(ax25_rt);
>> -}
>> -
>>   typedef struct {
>>   	char			slave;			/* slave_mode?   */
>>   	struct timer_list	slave_timer;		/* timeout timer */
>> diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
>> index d0b2e094bd55..be97dc6a53cb 100644
>> --- a/net/ax25/ax25_route.c
>> +++ b/net/ax25/ax25_route.c
>> @@ -111,7 +111,6 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
>>   		return -ENOMEM;
>>   	}
>>   
>> -	refcount_set(&ax25_rt->refcount, 1);
>>   	ax25_rt->callsign     = route->dest_addr;
>>   	ax25_rt->dev          = ax25_dev->dev;
>>   	ax25_rt->digipeat     = NULL;
>> @@ -160,12 +159,12 @@ static int ax25_rt_del(struct ax25_routes_struct *route)
>>   		    ax25cmp(&route->dest_addr, &s->callsign) == 0) {
>>   			if (ax25_route_list == s) {
>>   				ax25_route_list = s->next;
>> -				ax25_put_route(s);
>> +				__ax25_put_route(s);
>>   			} else {
>>   				for (t = ax25_route_list; t != NULL; t = t->next) {
>>   					if (t->next == s) {
>>   						t->next = s->next;
>> -						ax25_put_route(s);
>> +						__ax25_put_route(s);
>>   						break;
>>   					}
>>   				}
>> -- 
>> 2.34.1
>>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH net-next 06/15] net: ax25: remove route refcount
  2022-01-27 15:58     ` David Ranch
@ 2022-01-28 10:21       ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2022-01-28 10:21 UTC (permalink / raw)
  To: David Ranch
  Cc: Thomas Osterried, Jakub Kicinski, davem, netdev, ralf, linux-hams

On Thu, Jan 27, 2022 at 07:58:40AM -0800, David Ranch wrote:
> 
> Curious, has this change been tested with an actual testbed to confirm it
> doesn't break anything?  We *have* to stop allowing good intentioned but
> naive developers from submitting patches when they've never tested the
> resulting change.

Hopefully Jakub is not *too* naive, given that he (along with Dave
Miller) have final say over everything networking related in the Linux
kernel.  :P

Plus, we all reviewed the patch and it's fine.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-01-28 10:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 19:10 [PATCH net-next 00/15] net: get rid of unused static inlines Jakub Kicinski
2022-01-26 19:10 ` [PATCH net-next 01/15] mii: remove mii_lpa_to_linkmode_lpa_sgmii() Jakub Kicinski
2022-01-27 12:36   ` Vladimir Oltean
2022-01-26 19:10 ` [PATCH net-next 02/15] nfc: use *_set_vendor_cmds() helpers Jakub Kicinski
2022-01-27  7:30   ` Krzysztof Kozlowski
2022-01-26 19:10 ` [PATCH net-next 03/15] net: remove net_invalid_timestamp() Jakub Kicinski
2022-01-26 19:10 ` [PATCH net-next 04/15] net: remove linkmode_change_bit() Jakub Kicinski
2022-01-26 19:10 ` [PATCH net-next 05/15] net: remove bond_slave_has_mac_rcu() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 06/15] net: ax25: remove route refcount Jakub Kicinski
2022-01-27  9:18   ` Thomas Osterried
2022-01-27 15:58     ` David Ranch
2022-01-28 10:21       ` Dan Carpenter
2022-01-26 19:11 ` [PATCH net-next 07/15] hsr: remove get_prp_lan_id() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 08/15] ipv6: remove inet6_rsk() and tcp_twsk_ipv6only() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 09/15] dccp: remove max48() Jakub Kicinski
2022-01-26 19:11   ` Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 10/15] udp: remove inner_udp_hdr() Jakub Kicinski
2022-01-26 19:36   ` Willem de Bruijn
2022-01-26 19:11 ` [PATCH net-next 11/15] udplite: remove udplite_csum_outgoing() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 12/15] netlink: remove nl_set_extack_cookie_u32() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 13/15] net: sched: remove psched_tdiff_bounded() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 14/15] net: sched: remove qdisc_qlen_cpu() Jakub Kicinski
2022-01-26 19:11 ` [PATCH net-next 15/15] net: tipc: remove unused static inlines Jakub Kicinski
2022-01-27 14:20 ` [PATCH net-next 00/15] net: get rid of " patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.