Commit 37ac5db6 authored by David S. Miller's avatar David S. Miller

Merge branch 's390-net-next'

Julian Wiedmann says:

====================
s390/net: updates 2018-09-26

please apply one more series of cleanups and small improvements for qeth
to net-next. Note that one patch needs to touch both af_iucv and qeth, in
order to untangle their receive paths.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4b1bd697 91cc98f5
...@@ -582,7 +582,8 @@ struct qeth_cmd_buffer { ...@@ -582,7 +582,8 @@ struct qeth_cmd_buffer {
struct qeth_channel *channel; struct qeth_channel *channel;
unsigned char *data; unsigned char *data;
int rc; int rc;
void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *); void (*callback)(struct qeth_card *card, struct qeth_channel *channel,
struct qeth_cmd_buffer *iob);
}; };
static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob) static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob)
...@@ -671,6 +672,12 @@ struct qeth_card_info { ...@@ -671,6 +672,12 @@ struct qeth_card_info {
__u32 hwtrap; __u32 hwtrap;
}; };
enum qeth_discipline_id {
QETH_DISCIPLINE_UNDETERMINED = -1,
QETH_DISCIPLINE_LAYER3 = 0,
QETH_DISCIPLINE_LAYER2 = 1,
};
struct qeth_card_options { struct qeth_card_options {
struct qeth_routing_info route4; struct qeth_routing_info route4;
struct qeth_ipa_info ipa4; struct qeth_ipa_info ipa4;
...@@ -680,7 +687,7 @@ struct qeth_card_options { ...@@ -680,7 +687,7 @@ struct qeth_card_options {
struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */ struct qeth_sbp_info sbp; /* SETBRIDGEPORT options */
struct qeth_vnicc_info vnicc; /* VNICC options */ struct qeth_vnicc_info vnicc; /* VNICC options */
int fake_broadcast; int fake_broadcast;
int layer2; enum qeth_discipline_id layer;
int performance_stats; int performance_stats;
int rx_sg_cb; int rx_sg_cb;
enum qeth_ipa_isolation_modes isolation; enum qeth_ipa_isolation_modes isolation;
...@@ -690,6 +697,9 @@ struct qeth_card_options { ...@@ -690,6 +697,9 @@ struct qeth_card_options {
char hsuid[9]; char hsuid[9];
}; };
#define IS_LAYER2(card) ((card)->options.layer == QETH_DISCIPLINE_LAYER2)
#define IS_LAYER3(card) ((card)->options.layer == QETH_DISCIPLINE_LAYER3)
/* /*
* thread bits for qeth_card thread masks * thread bits for qeth_card thread masks
*/ */
...@@ -702,12 +712,6 @@ struct qeth_osn_info { ...@@ -702,12 +712,6 @@ struct qeth_osn_info {
int (*data_cb)(struct sk_buff *skb); int (*data_cb)(struct sk_buff *skb);
}; };
enum qeth_discipline_id {
QETH_DISCIPLINE_UNDETERMINED = -1,
QETH_DISCIPLINE_LAYER3 = 0,
QETH_DISCIPLINE_LAYER2 = 1,
};
struct qeth_discipline { struct qeth_discipline {
const struct device_type *devtype; const struct device_type *devtype;
int (*process_rx_buffer)(struct qeth_card *card, int budget, int *done); int (*process_rx_buffer)(struct qeth_card *card, int budget, int *done);
...@@ -759,7 +763,6 @@ struct qeth_switch_info { ...@@ -759,7 +763,6 @@ struct qeth_switch_info {
struct qeth_card { struct qeth_card {
struct list_head list; struct list_head list;
enum qeth_card_states state; enum qeth_card_states state;
int lan_online;
spinlock_t lock; spinlock_t lock;
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
struct qeth_channel read; struct qeth_channel read;
......
This diff is collapsed.
...@@ -31,10 +31,9 @@ static ssize_t qeth_dev_state_show(struct device *dev, ...@@ -31,10 +31,9 @@ static ssize_t qeth_dev_state_show(struct device *dev,
case CARD_STATE_SOFTSETUP: case CARD_STATE_SOFTSETUP:
return sprintf(buf, "SOFTSETUP\n"); return sprintf(buf, "SOFTSETUP\n");
case CARD_STATE_UP: case CARD_STATE_UP:
if (card->lan_online) return sprintf(buf, "UP (LAN %s)\n",
return sprintf(buf, "UP (LAN ONLINE)\n"); netif_carrier_ok(card->dev) ? "ONLINE" :
else "OFFLINE");
return sprintf(buf, "UP (LAN OFFLINE)\n");
case CARD_STATE_RECOVER: case CARD_STATE_RECOVER:
return sprintf(buf, "RECOVER\n"); return sprintf(buf, "RECOVER\n");
default: default:
...@@ -228,7 +227,7 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev, ...@@ -228,7 +227,7 @@ static ssize_t qeth_dev_prioqing_store(struct device *dev,
card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS; card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
} else if (sysfs_streq(buf, "prio_queueing_vlan")) { } else if (sysfs_streq(buf, "prio_queueing_vlan")) {
if (!card->options.layer2) { if (IS_LAYER3(card)) {
rc = -ENOTSUPP; rc = -ENOTSUPP;
goto out; goto out;
} }
...@@ -379,7 +378,7 @@ static ssize_t qeth_dev_layer2_show(struct device *dev, ...@@ -379,7 +378,7 @@ static ssize_t qeth_dev_layer2_show(struct device *dev,
if (!card) if (!card)
return -EINVAL; return -EINVAL;
return sprintf(buf, "%i\n", card->options.layer2); return sprintf(buf, "%i\n", card->options.layer);
} }
static ssize_t qeth_dev_layer2_store(struct device *dev, static ssize_t qeth_dev_layer2_store(struct device *dev,
...@@ -413,7 +412,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, ...@@ -413,7 +412,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
goto out; goto out;
} }
if (card->options.layer2 == newdis) if (card->options.layer == newdis)
goto out; goto out;
if (card->info.layer_enforced) { if (card->info.layer_enforced) {
/* fixed layer, can't switch */ /* fixed layer, can't switch */
...@@ -432,8 +431,6 @@ static ssize_t qeth_dev_layer2_store(struct device *dev, ...@@ -432,8 +431,6 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
card->discipline->remove(card->gdev); card->discipline->remove(card->gdev);
qeth_core_free_discipline(card); qeth_core_free_discipline(card);
card->options.layer2 = -1;
free_netdev(card->dev); free_netdev(card->dev);
card->dev = ndev; card->dev = ndev;
} }
......
...@@ -694,7 +694,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb, ...@@ -694,7 +694,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
int tx_bytes = skb->len; int tx_bytes = skb->len;
int rc; int rc;
if ((card->state != CARD_STATE_UP) || !card->lan_online) { if (card->state != CARD_STATE_UP) {
card->stats.tx_carrier_errors++; card->stats.tx_carrier_errors++;
goto tx_drop; goto tx_drop;
} }
...@@ -806,7 +806,6 @@ static int qeth_l2_probe_device(struct ccwgroup_device *gdev) ...@@ -806,7 +806,6 @@ static int qeth_l2_probe_device(struct ccwgroup_device *gdev)
} }
INIT_LIST_HEAD(&card->vid_list); INIT_LIST_HEAD(&card->vid_list);
hash_init(card->mac_htable); hash_init(card->mac_htable);
card->options.layer2 = 1;
card->info.hwtrap = 0; card->info.hwtrap = 0;
qeth_l2_vnicc_set_defaults(card); qeth_l2_vnicc_set_defaults(card);
return 0; return 0;
...@@ -998,10 +997,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -998,10 +997,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
goto out_remove; goto out_remove;
} }
card->state = CARD_STATE_SOFTSETUP; card->state = CARD_STATE_SOFTSETUP;
if (card->lan_online)
netif_carrier_on(card->dev);
else
netif_carrier_off(card->dev);
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
...@@ -1147,9 +1142,6 @@ static int qeth_l2_pm_resume(struct ccwgroup_device *gdev) ...@@ -1147,9 +1142,6 @@ static int qeth_l2_pm_resume(struct ccwgroup_device *gdev)
struct qeth_card *card = dev_get_drvdata(&gdev->dev); struct qeth_card *card = dev_get_drvdata(&gdev->dev);
int rc = 0; int rc = 0;
if (gdev->state == CCWGROUP_OFFLINE)
goto out;
if (card->state == CARD_STATE_RECOVER) { if (card->state == CARD_STATE_RECOVER) {
rc = __qeth_l2_set_online(card->gdev, 1); rc = __qeth_l2_set_online(card->gdev, 1);
if (rc) { if (rc) {
...@@ -1159,7 +1151,7 @@ static int qeth_l2_pm_resume(struct ccwgroup_device *gdev) ...@@ -1159,7 +1151,7 @@ static int qeth_l2_pm_resume(struct ccwgroup_device *gdev)
} }
} else } else
rc = __qeth_l2_set_online(card->gdev, 0); rc = __qeth_l2_set_online(card->gdev, 0);
out:
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
netif_device_attach(card->dev); netif_device_attach(card->dev);
if (rc) if (rc)
......
...@@ -1348,6 +1348,7 @@ static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, ...@@ -1348,6 +1348,7 @@ static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
static int qeth_l3_process_inbound_buffer(struct qeth_card *card, static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
int budget, int *done) int budget, int *done)
{ {
struct net_device *dev = card->dev;
int work_done = 0; int work_done = 0;
struct sk_buff *skb; struct sk_buff *skb;
struct qeth_hdr *hdr; struct qeth_hdr *hdr;
...@@ -1369,11 +1370,10 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, ...@@ -1369,11 +1370,10 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
magic = *(__u16 *)skb->data; magic = *(__u16 *)skb->data;
if ((card->info.type == QETH_CARD_TYPE_IQD) && if ((card->info.type == QETH_CARD_TYPE_IQD) &&
(magic == ETH_P_AF_IUCV)) { (magic == ETH_P_AF_IUCV)) {
skb->protocol = cpu_to_be16(ETH_P_AF_IUCV);
len = skb->len; len = skb->len;
card->dev->header_ops->create(skb, card->dev, 0, dev_hard_header(skb, dev, ETH_P_AF_IUCV,
card->dev->dev_addr, "FAKELL", len); dev->dev_addr, "FAKELL", len);
skb_reset_mac_header(skb); skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb(skb); netif_receive_skb(skb);
} else { } else {
qeth_l3_rebuild_skb(card, skb, hdr); qeth_l3_rebuild_skb(card, skb, hdr);
...@@ -2005,17 +2005,15 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_hdr *hdr, struct sk_buff *skb, ...@@ -2005,17 +2005,15 @@ static void qeth_l3_fill_af_iucv_hdr(struct qeth_hdr *hdr, struct sk_buff *skb,
unsigned int data_len) unsigned int data_len)
{ {
char daddr[16]; char daddr[16];
struct af_iucv_trans_hdr *iucv_hdr;
hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3;
hdr->hdr.l3.length = data_len; hdr->hdr.l3.length = data_len;
hdr->hdr.l3.flags = QETH_HDR_IPV6 | QETH_CAST_UNICAST; hdr->hdr.l3.flags = QETH_HDR_IPV6 | QETH_CAST_UNICAST;
iucv_hdr = (struct af_iucv_trans_hdr *)(skb_mac_header(skb) + ETH_HLEN);
memset(daddr, 0, sizeof(daddr)); memset(daddr, 0, sizeof(daddr));
daddr[0] = 0xfe; daddr[0] = 0xfe;
daddr[1] = 0x80; daddr[1] = 0x80;
memcpy(&daddr[8], iucv_hdr->destUserID, 8); memcpy(&daddr[8], iucv_trans_hdr(skb)->destUserID, 8);
memcpy(hdr->hdr.l3.next_hop.ipv6_addr, daddr, 16); memcpy(hdr->hdr.l3.next_hop.ipv6_addr, daddr, 16);
} }
...@@ -2235,7 +2233,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb, ...@@ -2235,7 +2233,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
goto tx_drop; goto tx_drop;
} }
if (card->state != CARD_STATE_UP || !card->lan_online) { if (card->state != CARD_STATE_UP) {
card->stats.tx_carrier_errors++; card->stats.tx_carrier_errors++;
goto tx_drop; goto tx_drop;
} }
...@@ -2489,7 +2487,6 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev) ...@@ -2489,7 +2487,6 @@ static int qeth_l3_probe_device(struct ccwgroup_device *gdev)
} }
hash_init(card->ip_htable); hash_init(card->ip_htable);
hash_init(card->ip_mc_htable); hash_init(card->ip_mc_htable);
card->options.layer2 = 0;
card->info.hwtrap = 0; card->info.hwtrap = 0;
return 0; return 0;
} }
...@@ -2576,10 +2573,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -2576,10 +2573,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
qeth_l3_recover_ip(card); qeth_l3_recover_ip(card);
if (card->lan_online)
netif_carrier_on(card->dev);
else
netif_carrier_off(card->dev);
qeth_enable_hw_features(card->dev); qeth_enable_hw_features(card->dev);
if (recover_flag == CARD_STATE_RECOVER) { if (recover_flag == CARD_STATE_RECOVER) {
...@@ -2717,9 +2710,6 @@ static int qeth_l3_pm_resume(struct ccwgroup_device *gdev) ...@@ -2717,9 +2710,6 @@ static int qeth_l3_pm_resume(struct ccwgroup_device *gdev)
struct qeth_card *card = dev_get_drvdata(&gdev->dev); struct qeth_card *card = dev_get_drvdata(&gdev->dev);
int rc = 0; int rc = 0;
if (gdev->state == CCWGROUP_OFFLINE)
goto out;
if (card->state == CARD_STATE_RECOVER) { if (card->state == CARD_STATE_RECOVER) {
rc = __qeth_l3_set_online(card->gdev, 1); rc = __qeth_l3_set_online(card->gdev, 1);
if (rc) { if (rc) {
...@@ -2729,7 +2719,7 @@ static int qeth_l3_pm_resume(struct ccwgroup_device *gdev) ...@@ -2729,7 +2719,7 @@ static int qeth_l3_pm_resume(struct ccwgroup_device *gdev)
} }
} else } else
rc = __qeth_l3_set_online(card->gdev, 0); rc = __qeth_l3_set_online(card->gdev, 0);
out:
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
netif_device_attach(card->dev); netif_device_attach(card->dev);
if (rc) if (rc)
......
...@@ -80,6 +80,11 @@ struct af_iucv_trans_hdr { ...@@ -80,6 +80,11 @@ struct af_iucv_trans_hdr {
u8 pad; /* total 104 bytes */ u8 pad; /* total 104 bytes */
} __packed; } __packed;
static inline struct af_iucv_trans_hdr *iucv_trans_hdr(struct sk_buff *skb)
{
return (struct af_iucv_trans_hdr *)skb_network_header(skb);
}
enum iucv_tx_notify { enum iucv_tx_notify {
/* transmission of skb is completed and was successful */ /* transmission of skb is completed and was successful */
TX_NOTIFY_OK = 0, TX_NOTIFY_OK = 0,
......
...@@ -320,13 +320,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, ...@@ -320,13 +320,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,
struct sk_buff *nskb; struct sk_buff *nskb;
int err, confirm_recv = 0; int err, confirm_recv = 0;
memset(skb->head, 0, ETH_HLEN); phs_hdr = skb_push(skb, sizeof(*phs_hdr));
phs_hdr = skb_push(skb, sizeof(struct af_iucv_trans_hdr)); memset(phs_hdr, 0, sizeof(*phs_hdr));
skb_reset_mac_header(skb);
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_push(skb, ETH_HLEN);
skb_reset_mac_header(skb);
memset(phs_hdr, 0, sizeof(struct af_iucv_trans_hdr));
phs_hdr->magic = ETH_P_AF_IUCV; phs_hdr->magic = ETH_P_AF_IUCV;
phs_hdr->version = 1; phs_hdr->version = 1;
...@@ -350,6 +346,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock, ...@@ -350,6 +346,9 @@ static int afiucv_hs_send(struct iucv_message *imsg, struct sock *sock,
if (imsg) if (imsg)
memcpy(&phs_hdr->iucv_hdr, imsg, sizeof(struct iucv_message)); memcpy(&phs_hdr->iucv_hdr, imsg, sizeof(struct iucv_message));
skb_push(skb, ETH_HLEN);
memset(skb->data, 0, ETH_HLEN);
skb->dev = iucv->hs_dev; skb->dev = iucv->hs_dev;
if (!skb->dev) { if (!skb->dev) {
err = -ENODEV; err = -ENODEV;
...@@ -1943,8 +1942,7 @@ static void iucv_callback_shutdown(struct iucv_path *path, u8 ipuser[16]) ...@@ -1943,8 +1942,7 @@ static void iucv_callback_shutdown(struct iucv_path *path, u8 ipuser[16])
/***************** HiperSockets transport callbacks ********************/ /***************** HiperSockets transport callbacks ********************/
static void afiucv_swap_src_dest(struct sk_buff *skb) static void afiucv_swap_src_dest(struct sk_buff *skb)
{ {
struct af_iucv_trans_hdr *trans_hdr = struct af_iucv_trans_hdr *trans_hdr = iucv_trans_hdr(skb);
(struct af_iucv_trans_hdr *)skb->data;
char tmpID[8]; char tmpID[8];
char tmpName[8]; char tmpName[8];
...@@ -1967,13 +1965,12 @@ static void afiucv_swap_src_dest(struct sk_buff *skb) ...@@ -1967,13 +1965,12 @@ static void afiucv_swap_src_dest(struct sk_buff *skb)
**/ **/
static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
{ {
struct af_iucv_trans_hdr *trans_hdr = iucv_trans_hdr(skb);
struct sock *nsk; struct sock *nsk;
struct iucv_sock *iucv, *niucv; struct iucv_sock *iucv, *niucv;
struct af_iucv_trans_hdr *trans_hdr;
int err; int err;
iucv = iucv_sk(sk); iucv = iucv_sk(sk);
trans_hdr = (struct af_iucv_trans_hdr *)skb->data;
if (!iucv) { if (!iucv) {
/* no sock - connection refused */ /* no sock - connection refused */
afiucv_swap_src_dest(skb); afiucv_swap_src_dest(skb);
...@@ -2034,15 +2031,13 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) ...@@ -2034,15 +2031,13 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb)
static int afiucv_hs_callback_synack(struct sock *sk, struct sk_buff *skb) static int afiucv_hs_callback_synack(struct sock *sk, struct sk_buff *skb)
{ {
struct iucv_sock *iucv = iucv_sk(sk); struct iucv_sock *iucv = iucv_sk(sk);
struct af_iucv_trans_hdr *trans_hdr =
(struct af_iucv_trans_hdr *)skb->data;
if (!iucv) if (!iucv)
goto out; goto out;
if (sk->sk_state != IUCV_BOUND) if (sk->sk_state != IUCV_BOUND)
goto out; goto out;
bh_lock_sock(sk); bh_lock_sock(sk);
iucv->msglimit_peer = trans_hdr->window; iucv->msglimit_peer = iucv_trans_hdr(skb)->window;
sk->sk_state = IUCV_CONNECTED; sk->sk_state = IUCV_CONNECTED;
sk->sk_state_change(sk); sk->sk_state_change(sk);
bh_unlock_sock(sk); bh_unlock_sock(sk);
...@@ -2098,8 +2093,6 @@ static int afiucv_hs_callback_fin(struct sock *sk, struct sk_buff *skb) ...@@ -2098,8 +2093,6 @@ static int afiucv_hs_callback_fin(struct sock *sk, struct sk_buff *skb)
static int afiucv_hs_callback_win(struct sock *sk, struct sk_buff *skb) static int afiucv_hs_callback_win(struct sock *sk, struct sk_buff *skb)
{ {
struct iucv_sock *iucv = iucv_sk(sk); struct iucv_sock *iucv = iucv_sk(sk);
struct af_iucv_trans_hdr *trans_hdr =
(struct af_iucv_trans_hdr *)skb->data;
if (!iucv) if (!iucv)
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
...@@ -2107,7 +2100,7 @@ static int afiucv_hs_callback_win(struct sock *sk, struct sk_buff *skb) ...@@ -2107,7 +2100,7 @@ static int afiucv_hs_callback_win(struct sock *sk, struct sk_buff *skb)
if (sk->sk_state != IUCV_CONNECTED) if (sk->sk_state != IUCV_CONNECTED)
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
atomic_sub(trans_hdr->window, &iucv->msg_sent); atomic_sub(iucv_trans_hdr(skb)->window, &iucv->msg_sent);
iucv_sock_wake_msglim(sk); iucv_sock_wake_msglim(sk);
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
} }
...@@ -2170,22 +2163,13 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -2170,22 +2163,13 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
int err = NET_RX_SUCCESS; int err = NET_RX_SUCCESS;
char nullstring[8]; char nullstring[8];
if (skb->len < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr))) { if (!pskb_may_pull(skb, sizeof(*trans_hdr))) {
WARN_ONCE(1, "AF_IUCV too short skb, len=%d, min=%d", WARN_ONCE(1, "AF_IUCV failed to receive skb, len=%u", skb->len);
(int)skb->len,
(int)(ETH_HLEN + sizeof(struct af_iucv_trans_hdr)));
kfree_skb(skb); kfree_skb(skb);
return NET_RX_SUCCESS; return NET_RX_SUCCESS;
} }
if (skb_headlen(skb) < (ETH_HLEN + sizeof(struct af_iucv_trans_hdr)))
if (skb_linearize(skb)) { trans_hdr = iucv_trans_hdr(skb);
WARN_ONCE(1, "AF_IUCV skb_linearize failed, len=%d",
(int)skb->len);
kfree_skb(skb);
return NET_RX_SUCCESS;
}
skb_pull(skb, ETH_HLEN);
trans_hdr = (struct af_iucv_trans_hdr *)skb->data;
EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName)); EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName));
EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID)); EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID));
EBCASC(trans_hdr->srcAppName, sizeof(trans_hdr->srcAppName)); EBCASC(trans_hdr->srcAppName, sizeof(trans_hdr->srcAppName));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment