~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mctp/test/utils.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/mctp/test/utils.c (Version linux-6.11.5) and /net/mctp/test/utils.c (Version linux-6.10.14)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 #include <linux/netdevice.h>                        3 #include <linux/netdevice.h>
  4 #include <linux/mctp.h>                             4 #include <linux/mctp.h>
  5 #include <linux/if_arp.h>                           5 #include <linux/if_arp.h>
  6                                                     6 
  7 #include <net/mctp.h>                               7 #include <net/mctp.h>
  8 #include <net/mctpdevice.h>                         8 #include <net/mctpdevice.h>
  9 #include <net/pkt_sched.h>                          9 #include <net/pkt_sched.h>
 10                                                    10 
 11 #include "utils.h"                                 11 #include "utils.h"
 12                                                    12 
 13 static netdev_tx_t mctp_test_dev_tx(struct sk_     13 static netdev_tx_t mctp_test_dev_tx(struct sk_buff *skb,
 14                                     struct net     14                                     struct net_device *ndev)
 15 {                                                  15 {
 16         kfree_skb(skb);                            16         kfree_skb(skb);
 17         return NETDEV_TX_OK;                       17         return NETDEV_TX_OK;
 18 }                                                  18 }
 19                                                    19 
 20 static const struct net_device_ops mctp_test_n     20 static const struct net_device_ops mctp_test_netdev_ops = {
 21         .ndo_start_xmit = mctp_test_dev_tx,        21         .ndo_start_xmit = mctp_test_dev_tx,
 22 };                                                 22 };
 23                                                    23 
 24 static void mctp_test_dev_setup(struct net_dev     24 static void mctp_test_dev_setup(struct net_device *ndev)
 25 {                                                  25 {
 26         ndev->type = ARPHRD_MCTP;                  26         ndev->type = ARPHRD_MCTP;
 27         ndev->mtu = MCTP_DEV_TEST_MTU;             27         ndev->mtu = MCTP_DEV_TEST_MTU;
 28         ndev->hard_header_len = 0;                 28         ndev->hard_header_len = 0;
 29         ndev->addr_len = 0;                        29         ndev->addr_len = 0;
 30         ndev->tx_queue_len = DEFAULT_TX_QUEUE_     30         ndev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
 31         ndev->flags = IFF_NOARP;                   31         ndev->flags = IFF_NOARP;
 32         ndev->netdev_ops = &mctp_test_netdev_o     32         ndev->netdev_ops = &mctp_test_netdev_ops;
 33         ndev->needs_free_netdev = true;            33         ndev->needs_free_netdev = true;
 34 }                                                  34 }
 35                                                    35 
 36 struct mctp_test_dev *mctp_test_create_dev(voi     36 struct mctp_test_dev *mctp_test_create_dev(void)
 37 {                                                  37 {
 38         struct mctp_test_dev *dev;                 38         struct mctp_test_dev *dev;
 39         struct net_device *ndev;                   39         struct net_device *ndev;
 40         int rc;                                    40         int rc;
 41                                                    41 
 42         ndev = alloc_netdev(sizeof(*dev), "mct     42         ndev = alloc_netdev(sizeof(*dev), "mctptest%d", NET_NAME_ENUM,
 43                             mctp_test_dev_setu     43                             mctp_test_dev_setup);
 44         if (!ndev)                                 44         if (!ndev)
 45                 return NULL;                       45                 return NULL;
 46                                                    46 
 47         dev = netdev_priv(ndev);                   47         dev = netdev_priv(ndev);
 48         dev->ndev = ndev;                          48         dev->ndev = ndev;
 49                                                    49 
 50         rc = register_netdev(ndev);                50         rc = register_netdev(ndev);
 51         if (rc) {                                  51         if (rc) {
 52                 free_netdev(ndev);                 52                 free_netdev(ndev);
 53                 return NULL;                       53                 return NULL;
 54         }                                          54         }
 55                                                    55 
 56         rcu_read_lock();                           56         rcu_read_lock();
 57         dev->mdev = __mctp_dev_get(ndev);          57         dev->mdev = __mctp_dev_get(ndev);
 58         dev->mdev->net = mctp_default_net(dev_     58         dev->mdev->net = mctp_default_net(dev_net(ndev));
 59         rcu_read_unlock();                         59         rcu_read_unlock();
 60                                                    60 
 61         return dev;                                61         return dev;
 62 }                                                  62 }
 63                                                    63 
 64 void mctp_test_destroy_dev(struct mctp_test_de     64 void mctp_test_destroy_dev(struct mctp_test_dev *dev)
 65 {                                                  65 {
 66         mctp_dev_put(dev->mdev);                   66         mctp_dev_put(dev->mdev);
 67         unregister_netdev(dev->ndev);              67         unregister_netdev(dev->ndev);
 68 }                                                  68 }
 69                                                    69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php