1 /* Intel Ethernet Switch Host Interface Driver
2 * Copyright(c) 2013 - 2014 Intel Corporation.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
16 * Contact Information:
17 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
18 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
23 static netdev_tx_t
fm10k_xmit_frame(struct sk_buff
*skb
, struct net_device
*dev
)
25 dev_kfree_skb_any(skb
);
29 static int fm10k_change_mtu(struct net_device
*dev
, int new_mtu
)
31 if (new_mtu
< 68 || new_mtu
> FM10K_MAX_JUMBO_FRAME_SIZE
)
39 static int fm10k_set_mac(struct net_device
*dev
, void *p
)
41 struct sockaddr
*addr
= p
;
44 if (!is_valid_ether_addr(addr
->sa_data
))
45 return -EADDRNOTAVAIL
;
48 ether_addr_copy(dev
->dev_addr
, addr
->sa_data
);
49 dev
->addr_assign_type
&= ~NET_ADDR_RANDOM
;
55 static void fm10k_set_rx_mode(struct net_device
*dev
)
59 static const struct net_device_ops fm10k_netdev_ops
= {
60 .ndo_validate_addr
= eth_validate_addr
,
61 .ndo_start_xmit
= fm10k_xmit_frame
,
62 .ndo_set_mac_address
= fm10k_set_mac
,
63 .ndo_change_mtu
= fm10k_change_mtu
,
64 .ndo_set_rx_mode
= fm10k_set_rx_mode
,
67 #define DEFAULT_DEBUG_LEVEL_SHIFT 3
69 struct net_device
*fm10k_alloc_netdev(void)
71 struct fm10k_intfc
*interface
;
72 struct net_device
*dev
;
74 dev
= alloc_etherdev(sizeof(struct fm10k_intfc
));
78 /* set net device and ethtool ops */
79 dev
->netdev_ops
= &fm10k_netdev_ops
;
81 /* configure default debug level */
82 interface
= netdev_priv(dev
);
83 interface
->msg_enable
= (1 << DEFAULT_DEBUG_LEVEL_SHIFT
) - 1;
85 /* configure default features */
86 dev
->features
|= NETIF_F_SG
;
88 /* all features defined to this point should be changeable */
89 dev
->hw_features
|= dev
->features
;
91 /* configure VLAN features */
92 dev
->vlan_features
|= dev
->features
;
94 /* configure tunnel offloads */
95 dev
->hw_enc_features
= NETIF_F_SG
;